| Next revision | Previous revision |
| scriptlog:lib:core:themerenderer [2026/09/26 09:09] – admin admin | scriptlog:lib:core:themerenderer [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Inheritance ======= | ======= Inheritance ======= |
| |
| ^ Relation ^ Type ^ Meaning ^ | ^ Relation ^ Type ^ Meaning ^ |
| | implements | [[scriptlog:lib:core:themerendererinterface|''ThemeRendererInterface'']] | contract | | | implements | [[scriptlog:lib:core:themerendererinterface|''ThemeRendererInterface'']] | contract | |
| |
| ======= Constants (5) ======= | ======= Constants (5) ======= |
| |
| ^ Visibility ^ Name ^ Value ^ Line ^ | ^ Visibility ^ Name ^ Value ^ Line ^ |
| | ''private'' | ''HEADER_TEMPLATE'' | '''header.php';'' | 36 | | | ''private'' | ''HEADER_TEMPLATE'' | '''header.php';'' | 36 | |
| | ''private'' | ''FOOTER_TEMPLATE'' | '''footer.php';'' | 41 | | | ''private'' | ''FOOTER_TEMPLATE'' | '''footer.php';'' | 41 | |
| | ''private'' | ''NOT_FOUND_TEMPLATE'' | '''404.php';'' | 46 | | | ''private'' | ''NOT_FOUND_TEMPLATE'' | '''404.php';'' | 46 | |
| | ''private'' | ''TEMPLATE_EXTENSION'' | '''.php';'' | 51 | | | ''private'' | ''TEMPLATE_EXTENSION'' | '''.php';'' | 51 | |
| | ''private'' | ''FALLBACK_THEME'' | '''blog';'' | 56 | | | ''private'' | ''FALLBACK_THEME'' | '''blog';'' | 56 | |
| |
| ======= Properties (0) ======= | ======= Properties (2) ======= |
| |
| //None declared.// | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | | ''private'' | ''string'' | ''$themeDir'' | | 66 | |
| | | ''private'' | ''(untyped)'' | ''$errorLogger'' | | 75 | |
| |
| ======= Methods (9) ======= | ======= Methods (9) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | Construct a new ThemeRenderer. | 89 | | | public | ''__construct()'' | Construct a new ThemeRenderer. | 89 | |
| | public static | ''fromGlobalContext()'' | Factory method that constructs a ThemeRenderer from global application context. | 117 | | | public static | ''fromGlobalContext()'' | Factory method that constructs a ThemeRenderer from global application context. | 117 | |
| | public | ''render()'' | Render a full page: header, content template, and footer. | 135 | | | public | ''render()'' | Render a full page: header, content template, and footer. | 135 | |
| | public | ''renderHeader()'' | Include the current theme's header template. | 146 | | | public | ''renderHeader()'' | Include the current theme's header template. | 146 | |
| | public | ''renderContent()'' | Include a content template from the current theme directory. | 162 | | | public | ''renderContent()'' | Include a content template from the current theme directory. | 162 | |
| | public | ''renderFooter()'' | Include the current theme's footer template. | 183 | | | public | ''renderFooter()'' | Include the current theme's footer template. | 183 | |
| | public | ''render404()'' | Render a 404 response. | 199 | | | public | ''render404()'' | Render a 404 response. | 199 | |
| | public | ''getThemeDir()'' | Return the resolved absolute path to the active theme directory. | 219 | | | public | ''getThemeDir()'' | Return the resolved absolute path to the active theme directory. | 219 | |
| | private | ''log()'' | Log a message via the configured error logger, if one is set. | 229 | | | private | ''log()'' | Log a message via the configured error logger, if one is set. | 229 | |
| |
| |
| Construct a new ThemeRenderer. | Construct a new ThemeRenderer. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$themesRootPath'' | ''string'' | //required// | Absolute path to the parent directory containing all theme directories, e.g. "/var/www/public/themes/". | | | ''$themesRootPath'' | ''string'' | //required// | Absolute path to the parent directory containing all theme directories, e.g. "/var/www/public/themes/". | |
| | ''$themeName'' | ''string'' | //required// | Name of the active theme directory (sanitized with {@see basename()}). | | | ''$themeName'' | ''string'' | //required// | Name of the active theme directory (sanitized with {@see basename()}). | |
| | ''$errorLogger'' | ''?callable'' | ''null'' | Optional error logger. | | | ''$errorLogger'' | ''?callable'' | ''null'' | Optional error logger. | |
| | ''$fallbackTheme'' | ''string'' | '''blog''' | Fallback theme name when the primary theme is missing required templates. | | | ''$fallbackTheme'' | ''string'' | '''blog''' | Fallback theme name when the primary theme is missing required templates. | |
| |
| |
| Sets the HTTP response code before any output is sent. | Sets the HTTP response code before any output is sent. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$template'' | ''string'' | //required// | Content template name (without .php extension). | | | ''$template'' | ''string'' | //required// | Content template name (without .php extension). | |
| | ''$statusCode'' | ''int'' | ''200'' | HTTP status code (default 200). | | | ''$statusCode'' | ''int'' | ''200'' | HTTP status code (default 200). | |
| |
| **Returns:** ''void'' | **Returns:** ''void'' |
| to prevent directory traversal attacks. | to prevent directory traversal attacks. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$template'' | ''string'' | //required// | Content template name (without .php extension). | | | ''$template'' | ''string'' | //required// | Content template name (without .php extension). | |
| |
| **Returns:** ''void'' | **Returns:** ''void'' |
| Log a message via the configured error logger, if one is set. | Log a message via the configured error logger, if one is set. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$message'' | ''string'' | //required// | The log message. | | | ''$message'' | ''string'' | //required// | The log message. | |
| |
| **Returns:** ''void'' | **Returns:** ''void'' |