Templates Overview
The Templates module is a powerful system that allows developers to provide different layouts for CMS content.
The following template filenames are recognized by the CMS by default. These do not need to be added to the Templates module to be activated.
- index.php (default home page template)
- ekk_articlepage.php (article detail template)
- ekk_eventpage.php (event detail template)
- ekk_sermonpage.php (if sermon module is enabled)
Adding templates to the CMS
- Upload the template file to your site's FTP server.
A template can exist in the root directory or in a subdirectory. - Log into the CMS and visit Content > Templates.
If you do not see the Templates tab, your account may not have valid permission. - Click "Add a New Template".
- Name: Enter a user-friendly name for the template. This will show in the Template drop-down list when editing a Page, Article, etc.
- File Name: Enter the path to the template file relative to the root directory on the FTP server.
- Description: an optional description of the template.
- Enabled? specifies which modules will have access to the template.
- Use as Default Template? specifies the modules that will use this template by default.
If another module currently has a default template set, this one will overwite the setting. - Use as Search Template? should only be checked for a custom template you have set up to display Search results
- Sections: Select the default Sections (or leave the selections set to None for no default).
Once the file name is entered, the template file will be downloaded and parsed for user-selectable sections. These will appear as Section options in the CMS when creating new content within modules that use templates.
One important note is that template files are parsed recursively. That is, in addition to sections being parsed from template files, section labels from any and all included files will also be parsed.
If you modify a template to include new sections you will need to go back into the CMS and open that template in the template manager and allow the CMS to search for and find the new section so that it gets registered with the CMS. Then save the template with the newly found sections.
Adding Templates in Bulk
The CMS also supports bulk import of templates, navigate to Content > Templates > Bulk. The document root directory of the FTP server will be scanned and all PHP templates will be listed. All checked templates will be imported into the system. It is highly recommended that user-friendly names are entered prior to import.
Using templates with records for modules
After a template file has been successfully added via the backend, the template can be used for new and existing records for modules that use template management. These modules include: Blogs, Pages, & Newsletters.
To associate a template with a record, select a template from the Template drop down. When a template is selected, the sections associated with that template will be displayed, along with the default sections selected for that template. These sections can be custom selected for the each record.
Template Sections not appearing?
If your template has any include files in the code, that do not actually exist on the server, the template manager will fail to register any Sections.