Last Modified: 12.12.2014
Pages in the site public section are displayed based on site design templates.
Design template is a visual appearance of the site where the layout of various elements on the site is determined along with the artistic style and page display mode. It includes program html code, graphic elements, style tables, and additional files for content display. It also may include templates of components, templates of ready-made pages, and snippets.
Generally, the site template sets the “framing” of a page, and the visual components take care of the display of dynamic information.
The number of design templates used on the site is unlimited. A condition is set for each template determining when this template should be applied to site pages:
Condissions of assigning templates to site pages are set for each site individually on the "Edit site" page: Settings -> System settings -> Websites -> Websites:
This form allows to define a set of conditions that will regulate the site design selection, in the site settings.
Site template includes the following:
- A set of files in the catalog /bitrix/templates/site template ID/,
where site template ID is the ID field in the form of the editing of a site template. The structure of this catalog is provided below:
- File header.php - the prologue of this template;
- File footer.php - the epilogue of this template;
- File styles.css contains CSS styles of the template;
- /components/ contains a catalog with component templates that belong to a certain module;
- /lang/ - language files belonging both to this template in general and to specific components;
- /images/ - catalog with images of this site template;
- /page_templates/ - catalog with page templates and their description stored in the file .content.php. When a user creates a new page, they can choose which template to use.
- /include_areas/ - catalog with files that include the contents of the areas to be included. A random (i.e. no rules apply to its name) folder for files of the component areas to be included (main.include). Normally, a component is invoked from the site template. Files of the areas to be included shall be grouped in this file for convenience, because they may have a specific layout for the particular site template. There may be a name, logo, and contact information so that a user could edit only these data without interfering with site template.
- And also a number of other auxiliary random files included in this template.
Site template styles should be connected last, as it is the last possibility to redetermine, for example, standard component styles. Otherwise, a large-scale customization of component templates is necessary. If there is a need to connect own styles last, it can be done using the function of CMain::AddHeadString.