Introduction to InstantCMS templates
InstantCMS templates are located in subcategories of the
For instance, the template called «test» is located in the
There is the «default» template in InstantCMS by default. For a better understanding of how to create a custom template, carefully examine the files it contains.
InstantCMS does not use any template engine like Smarty or Twig. All code is written in PHP. The main purpose of InstantCMS templates is to separate presentation from logic.
What kind of template files can be?
Under template files we assume certain files with the
.tpl.php double extension. In other words, the files are ordinary PHP files, while the second .tpl extension indicates the template file. In the full title of the file, anything that comes before
.tpl.php is the template title. For example, a file is called
index.tpl.php - the engine will operate with the
index name only.
An InstantCMS template consists of a common layout (there can be more than one) and output files-templates.
A common layout is the main template of all site pages and contains the <html>, <head> and <body> tags. The templates of components and widgets are output inside it. By default, the engine uses two layouts: main.tpl.php for the site and admin.tpl.php for the Control panel.
A list of standard template files and directories
The path to the files from the tables below is specified relative to the template’s root directory, i.e., if a template is located in the
/templates/test/ directory, the paths below are specified relative to
Required template files
|main.tpl.php||Main template layout|
|admin.tpl.php||Control panel layout *|
|scheme.html||Template position layout|
* The file is required if other than the default template is chosen for the Control panel. On the contrary, the template may not contain this file.
Other files and directories
|Path to a file or directory||Assignment|
|options.form.php||template options form's file|
|assets/errors/||error templates, 404 page template and messages notifying that the site is closed|
|assets/fields/||templates of form fields|
|assets/ui/||templates of “breadcrumbs”, content filter panels, forms, menus and Control panel entry lists|
|content/||templates of entry lists and content type entry pages|
|controllers/CONTROLLER/||controller frontend templates|
|controllers/CONTROLLER/styles.css||controller CSS file|
|controllers/CONTROLLER/backend/||controller backend templates|
|controllers/CONTROLLER/backend/styles.css||controller backend's CSS file|
|controllers/CONTROLLER/widgets/WIDGET/||controller widget templates|
|css/||template CSS files linked in the layout|
|images/||images used in a template|
|profiles/options.form.php||an option form to customize user profiles|
|profiles/styler.php||a set of dynamically created CSS styles to customize user profiles|
|widgets/||a directory of widget templates not linked to controllers|
|widgets/wrapper*.tpl.php||files-wrappers in which the widget work results are displayed|
How the engine works with template files