Skip to content
risingisland edited this page Dec 13, 2025 · 1 revision

Twig Integration for GetSimple CMS

Adds Twig template engine support to GetSimple CMS. This plugin integrates the Twig templating engine into GetSimple, enabling you to render .twig templates for your themes or plugin outputs.

Features

🔹 Load and render Twig templates from your theme or plugin files

🔹 Pass variables from GetSimple into Twig templates

🔹 Enhance template structure with Twig’s control structures (loops, conditions), filters, and includes

Usage

In your GetSimple theme (template.php) add:

<?php 
// Render a Twig template
twig_template('page.twig', [
    'custom_var' => 'Sample value',
    'items' => ['Item 1', 'Item 2', 'Item 3']
]);
?>

Twig template (page.twig)

<div class="container">
    <h1>{{ page_title }}</h1>
    
    <div class="content">
        {{ page_content()|raw }}
    </div>
    
    <p>{{ custom_var }}</p>
    
    <ul>
    {% for item in items %}
        <li>{{ item }}</li>
    {% endfor %}
    </ul>
</div>

Clone this wiki locally