Documentation

IncludeTemplateLangFile

IncludeTemplateLangFile(
 string abs_path,
 string lang = false
);

The function is used to include language files into scripts located in the current site template directory. The function is usually used in components, or in the site prologue and/or epilogue.

Language file search algorithm:

  1. First, the language file will be searched in the following folder:

    /bitrix/templates/current site template ID/lang/language ID/relative path to script

  2. If the file is not found, the search will continue in the following folder:

    /bitrix/templates/.default/lang/language ID/relative path to script

  3. If the file is still not found, the module installation folder is searched:

    /bitrix/modules/module ID/install/templates/lang/language ID/relative path to script

Commonly, a "relative path to script"

Generally, a "relative path to script" is the path to file relative to the folder /bitrix/templates/current site template ID/.

In specific instances, when including components, the "relative path to script", is the component inclusion path passed to the CMain::IncludeFile method as the first parameter.

Function parameters

.
ParameterDescription
abs_path Absolute path to file for which the language message file is to be included.
langThe language ID.
Optional parameter. By default, the current language is used (false).

See Also

  • IncludeModuleLangFile

    Examples of use

    <?
    // Include language file into the current component
    // The language file is assumed to be stored in standard location
    IncludeTemplateLangFile(__FILE__);
    ?>


  • © «Bitrix24», 2001-2024
    Up