Skip to content
hertsch edited this page Aug 7, 2013 · 4 revisions

Twig is a modern template engine which is fast, secure, flexible and easy to use.

The kitFramework provide you with Twig. This template engine is well documented so there is no need to create a own documentation for Twig.

You can access Twig everywhere in kitFramework with $app['twig'].

The kitFramework extend Twig with some functions (for usage within the templates):

  • is_authenticated() return true if the CMS user is authenticated
  • user_display_name() return the name of a authenticated CMS user
  • template_file() maps $app['utils']->templateFile() (see Using Class Basic)

and inject some constants for the usage in Twig, like:

  • CMS_URL - the URL of the CMS
  • THIRDPARTY_URL the URL to third party extensions

please look at kitFramework Constants for a complete list.

The kitFramework expect that you are using the following scheme for your templates:

Template Directory

In general all extensions should use a Model View Control Pattern, the kitFramework is using Data (Model) - Template (View) - Control (Control).

  • Your Template (View) folder must have the name /Template - otherwise the dynamic assigning of templates will not work for your extension.
  • The /Template must contain a /default folder, which will be selected if no other template is select.

You will find hints for the usage of Twig in this tutorial and too in the kitFramework, but in general you should use Twig as you like.

In the next step start using the kitCommands for more complex and interactive extensions

Clone this wiki locally