Bitrix Site Manager

Site template

The synonyms of the term "site template" are "site design", "site skin". Several templates may be used to display a site. In the strict sense, a site template comprises: 

A template can be applied to a site in the administrative menu Sites, in the site settings (click the Modify link), the Design section:

The site template is selected by calling CSite::GetCurTemplate; its algorithm can be described as follows:

  1. All site templates are chosen in the following order:
    1. those containing the PHP condition (the highest priority);
    2. sort weight (the less is the value the higher is the priority);
    Thus, templates containing either the PHP condition or the less sort weight value, will have the highest priority.
  2. Then, the loop iterates on all the chosen templates. If the template contains the PHP condition, it is evaluated and if the result is "true", the path /bitrix/templates/site template ID/ is checked for existence. It this path exists, the loop breaks and the function CSite::GetCurTemplate returns this site template ID.
  3. In case none of the templates could be matched, the default template .default.php is returned.

When specifying the PHP condition, it should be considered that the check is implemented by the function which has its own scope of variables. That's why the global variables should be specified by using the array $GLOBALS, the request variables - through the array $_REQUEST (or $_GET, $_POST) etc.

The current site template is determined at the end of the prologue service section (prolog_before.php). Hence, the following can be used:

When specifying the PHP condition for choosing the site template, it should be considered that the use of section properties is allowed, while page properties are not allowed. This is because the section properties are stored in a separate file .section.php, and the page properties are specified usually in a page body, after the including the prologue service section.

In the public section, the current site template ID is stored in the constant SITE_TEMPLATE_ID.

Examples of specifying the conditions for inclusion of a site template

If a request (GET or POST) contains the parameter print equal to "Y":


If the section property phone is "Y":


If the current section is "/en/catalog/phone/":


Is the current user is an administrator: