Code Monkey home page Code Monkey logo

twig_plugin's Introduction

twig_plugin

Include Twig Engine in GetSimple CMS for make simple themes

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.

#Installation You can download the plugin from the GetSimple repository here and extract the content in to the 'plugins' folder of GetSimple; OR you can download the master in github and put in the plugin directory only the 'twig_plugin' folder and the 'twig_plugin.php' file.

#How To build a theme with the plugin? In mytheme folder you will also find a skeleton theme, to be used to build new themes

twig_plugin's People

Contributors

labgua avatar

Watchers

 avatar

Forkers

kazu2012

twig_plugin's Issues

Page class clash with other plugins

An interesting plugin, thank you.

On first enabling the plugin, your class name Page clashed with the Andrea Micheloni's sitemap plugin.
Page is a popular name in this context.
I solved it by adding namespace Gustaferro to twig_plugin.php and PageModel.class.php, then calling Gustaferro\render() in template.php.

How to include queued css and js

Is there a way to include CSS and JS inserted by other plugins using queue_style|script() in a TWIG way, rather than still including <?php get_header(TRUE); ?> and <?php get_footer(); ?> in the theme somewhere?
It's a similar issue to components, but can't be evaluated until all the plugins have processed, particularly when a content plugin adds JS intended for footer inclusion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.