Templates

From AV Scripts Wiki
Revision as of 07:21, 28 March 2015 by Andy (Talk | contribs) (Overriding Templates and Assets)

Jump to: navigation, search

Templates in AVCMS are built using the Twig template engine.

Getting Started

If you are not familiar with the Twig template engine then your first step is to learn the basics by reading the Twig documentation.

Next you will want to enable Developer Mode so that the changes you make during development are instantly reflected. If you are not in developer mode, you will need to refresh the caches in the admin panel every time you modify a template file.

Overriding Templates and Assets

The only template required in your theme is the index.twig file. But if you want to change the layout of other pages beyond what you are able to do with CSS, you can override them. You can also override default CSS and Javascript files. Remember, the more files you override, the more work you need to do when AVCMS is updated and changes are made.

The first step to overriding a file is finding out the name and location of the file you want to overwrite. When in developer mode you can find the name of the current page template on the developer toolbar at the bottom of all pages. To see the actual location of the template file, hold your cursor over the name and it will appear.

Template Settings

You can create settings for your template that can be configured by admins in the AVCMS admin panel. For example you could have a setting that changes the background colour of the page or a setting that allows users to change the site logo.