Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:core:themerendererinterface

This is an old revision of the document!


ThemeRendererInterface

Layer: Core · Source: lib/core/ThemeRendererInterface.php:18 (lines 18–71)


interface ThemeRendererInterface

Contract for theme rendering in the application.

Implementations are responsible for locating the active theme directory, resolving fallback themes when the primary is missing, and rendering header / content / footer templates in the correct sequence.

Each rendering method outputs HTML directly via include statements. Callers must not assume output buffering is active.

Inheritance

No parent, interface or trait. This is a root type.

Constants (0)

None.

Properties (0)

None declared.

Methods (6)

^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''render()'' | Render a full page: header, content template, and footer. | 28 |
| public | ''renderHeader()'' | Include the current theme's header template. | 36 |
| public | ''renderContent()'' | Include a content template from the current theme directory. | 46 |
| public | ''renderFooter()'' | Include the current theme's footer template. | 51 |
| public | ''render404()'' | Render a 404 response. | 60 |
| public | ''getThemeDir()'' | Return the resolved absolute path to the active theme directory. | 70 |

render()

public function render(string $template, int $statusCode = 200): void

line 28

Render a full page: header, content template, and footer.

Sets the HTTP response code before any output is sent.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$template'' | ''string'' | //required// | Content template name (without .php extension). |
| ''$statusCode'' | ''int'' | ''200'' | HTTP status code (default 200). |

Returns: void

renderHeader()

public function renderHeader(): void

line 36

Include the current theme's header template.

Outputs the opening HTML structure (doctype, head, navigation). Called internally by {@see render()}.

Takes no parameters.

Returns: void

renderContent()

public function renderContent(string $template): void

line 46

Include a content template from the current theme directory.

The template name is sanitized with {@see basename()} before inclusion to prevent directory traversal attacks.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$template'' | ''string'' | //required// | Content template name (without .php extension). |

Returns: void

renderFooter()

public function renderFooter(): void

line 51

Include the current theme's footer template.

Takes no parameters.

Returns: void

render404()

public function render404(): void

line 60

Render a 404 response.

Sets a 404 HTTP status code, then renders the header, the 404 content template, and the footer. If the 404 template does not exist a warning is logged and rendering continues silently.

Takes no parameters.

Returns: void

getThemeDir()

public function getThemeDir(): string

line 70

Return the resolved absolute path to the active theme directory.

The path always ends with a directory separator.

Takes no parameters.

Returns: string — string Absolute path to the theme directory, e.g. “/var/www/public/themes/blog/”


This page is generated from source by 'tools/gendoc'. Edits will be overwritten.

scriptlog/lib/core/themerendererinterface.1790413762.txt.gz · Last modified: by admin