Anatomy of a Unicity CMS template

Templates in Unicity CMS are designed to allow you to code whatever website you like. There are some fundamentals you'll need to stick to, but its then up to you how you want to make your website in Unicity. 

A website will normally have one master template, which is called "default", however it may also have other templates which can be attached to different sections of a website if required.

Header and Footer

These are PHP files that are included at the start and end of a page. Depending on your design and code structure you may wish to include lots of your design in the header and footer, otherwise you may want to keep these minimal and instead include your code in the Page Layout templates.

CSS files

Unicity CMS requires two CSS files, layout.css and designstyle.css as part of your template, which should be placed in the /css subfolder of the template. You can however have as many other CSS files as you wish.

designstyle.css is used to style the content in WYSIWYG editors within Unicity CMS, so all styles relating to typography and user selectable styles should be included in this file.

layout.css would normally include any structural styles.

Unicity CMS includes and SCSS to CSS compiler for development efficiency, however this can be disabled if you wish to use an offline compiler.

Images

It is strongly suggested that all images related to your template are stored in the /images sub folder of your template to avoid them being interfered with by users.

User editable images should be stored in the root /images folder, as this is accessible to users within the CMS interface.

App and module templates

Some Unicity Apps and Modules can also have their layouts customised through PHP files included in your template folder. For more details see the documentation for that module.

Page Layout Templates (.tmpl files)

Unicity CMS uses .tmpl files to define HTML layouts. Each website will need at least one page layout template, but you'll often have more than one to allow for different page types, with different editable regions.

Additionally, TMPL files may include other TMPL files, where common elements may be shared between multiple templates.

To allow a user to select a template, it should be named templateX, where X is a number, for example template1.tmpl

You don't have to use sequential numbers for templates, if you wish to share templates between different projects it may help to use larger, non-sequential numbers.

Included templates can have any name you wish, for example partial.tmpl.

Page layout templates are shared between all master templates to allow the same layouts to be used with different headers, footers and CSS if required.

Template field definitions

Each page layout template that you wish to be selected by a user needs to have its own corresponding field definition file. This is a PHP file containing arrays that define the editable regions of the templates.

These files should be named templateX.php, where X is the corresponding number of the TMPL file, e.g. template1.php.

Page layout templates and template field definitions should be placed directly in the /templates folder of your website.