A page template is a PHP file whose content conforms to the rules of
forming the page structure.
Page templates can be used when creating a new page in the module Site
Page templates are stored in the following folders:
- /bitrix/templates/site template ID/page_templates/
Each of these folders may contain page template files and a service file .content.php
whose main task is to store the descriptions and of page template sort order.
This information is stored in the array $TEMPLATES, whose structure is
[file name] => Array
[name] => page template title
[sort] => sort weight
When building the list of page templates, the following algorithm is used.
- Obtain the site template ID for the current site which is
included without the PHP condition;
- Consecutively include files:
In each of these files, a correspondent array $TEMPLATES is described.
After including these files, we will have a combined array $TEMPLATES.
Then, perform the following actions for each element of this array,
being a description of a page template:
- /bitrix/templates/site template ID/page_templates/.section.php
- check whether the page template physically exists;
- if it does, add it to the list of templates.
- Sort the obtained list of templates by the sort weight
(see the structure of the array $TEMPLATES above).