PHP code example of wanze / template-engine-factory

1. Go to this page and download the library: Download wanze/template-engine-factory 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/ */

    

wanze / template-engine-factory example snippets


$factory = wire('modules')->get('TemplateEngineFactory');

// Render foo.html.twig with some data.
$factory->render('foo', ['title' => 'Foo', 'body' => 'Hello World']);

// Form has been submitted, do some processing, send mail, save data... 
if ($input->post->form) {
  // ...
  $session->redirect('./');
}

// Forward some data to twig
$view->set('nav_items', $pages->get('/')->children());