Allows you to easily use the Twig Templating Engine for output.

TemplateTwig

Adds a Twig render method to Page
For more information on Twig visit http://twig.sensiolabs.org/
Copyright (C) 2012 by Paul Sheean porl42@gmail.com
Licensed under GNU/GPL v2, see LICENSE.txt
For Twig license see LICENSE.twig.txt

Installation


  • Copy TemplateTwig directory to site/modules

  • Enable TemplateTwig module in ProcessWire

  • Ensure module configuration (paths etc) is correct.

  • Your templates now have access to a twig parameter that can be used as follows:

      $variables = array("foo" => "bar", "hello" => "world);
      echo $page->twig->render('basic-page.html.twig', $variables);

    The templates directory with this module contains sample Twig templates and views
    that recreate the standard site-default templates with Twig. If you don't want to use
    them then just create the templates/views directory and use the files from here
    as a guide to make your own.

  • Create pages that use the twig templates.
    NOTE: As Twig handles html escaping etc itself, you can usually remove any htmlspecialchars filters from your fields. If you don't do this you may run into double-escaping issues.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Latest news

  • ProcessWire Weekly #542
    In the 542nd issue of ProcessWire Weekly we'll check out a couple of new third party modules, a new site of the week, and more. Read on!
    Weekly.pw / 28 September 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“We were really happy to build our new portfolio website on ProcessWire! We wanted something that gave us plenty of control on the back-end, without any bloat on the front end - just a nice, easy to access API for all our content that left us free to design and build however we liked.” —Castus, web design agency in Sheffield, UK