PureWiki utilizes a straightforward, PHP-based templating system for rendering the public frontend. This system prioritizes simplicity and performance over complex template languages like Twig or Blade.
Architecture
Themes are located in the themes/ directory. The core layout file is always named page.php.
Directory Structure
themes/default/
├── page.php # Main layout file
├── elements/ # Reusable HTML snippets
│ ├── header.php
│ ├── content.php
│ └── footer.php
Performance Tip:
When including static snippets like
header.php, use echo file_get_contents(__DIR__ . '/path') to minimize PHP parsing overhead.Placeholders and Variables
Placeholders are denoted by {{ variable_name }}. The renderer replaces these during the build process.
Available System Variables
{{ content }}: The rendered HTML content of the page blocks.{{ page_title }}: The title of the current page.{{ wiki_name }}: The name configured in global settings.{{ wiki_description }}: The global wiki description.{{ wiki_logo }}: URL to the wiki logo.{{ wiki_favicon }}: URL to the favicon.{{ author }}: The last author who saved the page.{{ date_created }}/{{ date_modified }}: Localized date strings.{{ date_created_iso }}/{{ date_modified_iso }}: ISO format (Y-m-d).{{ current_year }}: Useful for copyright footers.{{ current_theme }}: Name of the active theme folder.{{ context_path }}: Relative URL path of the current page.{{ assets_head }}: Injects CSS and head-scripts (Required in <head>).{{ assets_footer }}: Injects footer scripts (Required before </body>).
Conditional Logic
The renderer supports simple {{ if variable }} and {{ endif }} blocks.
{{ if hide_left_sidebar }}
<!-- Sidebar is hidden via page settings -->
{{ else }}
<aside>
{{ virtual:left_sidebar }}
</aside>
{{ endif }}
Virtual Pages and Macros
Themes rely on Virtual Pages ({{ virtual:name }}) for global content and Macros ({{ macro:name }}) for dynamic logic like search or navigation.