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

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.