Documentation

GetTemplatePath

string
CMain::GetTemplatePath(
 string rel_path
)

The method creates the path to the component relative to the site root fr om the specified path to component. Non-static method.

Parameters

ParameterDescription
rel_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
    here module ID - wh ere module ID is the first subdirectory in the component_path folder.

See Also

Examples of use

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


© «Bitrix24», 2001-2022
Up