Bitrix Site Manager

CMain::GetTemplatePath

string
CMain::GetTemplatePath(
 string component_path
)

The method GetTemplatePath creates the path to the component relative to the site root from the specified path to component.

Parameters

ParameterDescription
component_path Path to the component.

The following algorithm is used to search for the path relative to the site root:
  1. Search for file of the component in
    /bitrix/templates/current site template ID/component_path
  2. If not found, search in
    /bitrix/templates/.default/component_path
  3. If still not found, search in
    /bitrix/modules/module ID/install/templates/component_path
where module ID is the first subdirectory in the folder component_path.

See Also

Example



<?
// obtain the real path to a component
$path = $APPLICATION->GetTemplatePath("iblock/catalog/element.php");
// $path may contain the following: 
// "/bitrix/templates/.default/iblock/catalog/element.php"
?>