Twig Plugin

Downloads: 1578
Category: Plugin
Compatible with: GetSimple 3.3 - 3.3

Last Updated: September 30, 2016
Tags: template engine twig simple theme mvc model view control graphic design
Author: Serbian
Author Website: https://www.linkedin.com/in/sergio-guastaferro-5826a171

(3) 4 Votes

Plugin Description:

This plugin allows you to use the Twig template engine within the themes that use it.

In particular, the plug-in incorporates the twig code and offers 3 functions that allow you to instantiate and run the render of a twig-script. These functions can be easily called in the GetSimple template file.

The plugin defines the following functions:

getTwig ()

This function returns an instance of twig already initialized. The plugin is assumed that into the theme is present the 'views' folder where the script will look for twig-files

getPageModel ()

This function return a Page object; This object contains all the information which refer the page to load, the selected theme, general information of the site, including of course the title of the page and its contents. This is a wrapper of the most important information for implementing the page to display

render ()

This method is a shortcut that allows you to run the render the page in question, the requested page. This uses the above functions to RETURN the content to display.

How To build a theme with the plugin?

I have created a skeleton theme, to be used to build new themes. See more on twig_plugin on GitHub

FIX and Features

  • fixed problem on the generation of the menus

  • Added support for components of getsimple (es. getcomponent('sidebar') ) now accessible via {{ components.namecomponent }}

  • fixed problem on generation of components


Links

for more information visit these sites :

twig_plugin on GitHub

About Me

Install Instructions:

To install this plugin you must extract the content of the archive into the 'plugins' folder of getsimple.

After you can activate the plugin from the plugin section, and then the functions are ready to be useed by themes

Archived Versions:

These are old versions of this file. Please use with caution as they are probably out of date and no longer supported. ShowHide