Last Modified: 10.10.2012
An unlimited number of different site templates can be used for each site.
When creating a site you can choose three different templates in the site settings and specify the conditions with which they will be applied on the site. After the record is saved, three new fields will be added.
Site templates can be applied to a site according to the following conditions:
- for file or folder – you can browse the site structure and select a page or a section to which the template is to be applied;
- for user group – you can select more that one user groups currently existing on the site;
- time period – specify the bounds of the time period when a template is to be applied. If the upper bound is not specified, the period is timeless.
- URL parameters – specify a name and a value of the URL parameter, for example, print=Y.
- PHP expression – any PHP condition can be used here.
Note! Condition is an expression that can be put inside the if() operator.
For example: $USER->IsAuthorized().
Please bear in mind that after a condition is applied (for example, after the folder is selected, for which the template will be used), you can set the PHP expression
condition. Then, the program code for the specified condition will be shown in the condition field.
For example, after you have selected the template for the /partners/ section, selecting the PHP expression option displays "CSite::InDir('/partners/')".
The PHP expression can be modified in an arbitrary way. You can combine different conditions. For example, set the template to be applied only to a definite folder and only for authorized users:
CSite::InDir('/partners/') && $USER->IsAuthorized()