PHP code example of fvsch / kirby-twig

1. Go to this page and download the library: Download fvsch/kirby-twig library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fvsch / kirby-twig example snippets


 /* site/templates/hello.php */ 


// site/plugins/composer/composer.php

// Composer autoload

// Register the Twig plugin's template component
Kirby\Twig\Plugin::register();



// Render a simple template from the site/snippets directory
echo twig('@snippets/header.twig');

// Same, but passing some additionnal variables
echo twig('@snippets/header.twig', ['sticky'=>false]);

// Render a string
echo twig('Hello {{ who }}', ['who'=>'World!']);

site
 └─ plugins
     └─ twig
         ├─ lib
         ├─ src
         └─ twig.php

site
 └─ plugins
     └─ composer
         └─ composer.php