Views: 6004
Last Modified: 10.10.2012

The simple component template folder can contain the following folders and subfolders:

  • The subfolder lang containing component language-dependent messages in nested subfolders. The subfolder names are the abbreviations of languages in which the text messages are stored. A good practice is to save a text message file under the same name as a corresponding file of the component, and store it in the same folder hierarchy. For example, the file with English messages for /install/uninstall.php is to be saved in /lang/en/install/uninstall.php. The lang folder is optional if the component does not use language-dependent messages.
  • The file result_modifier.php. It is included immediately before the inclusion of a component template. This file takes the component results as an array $arResult, and the component input array $arParams. This allows to change the contents of $arResult as required. Imagine a system component that does everything you need but does not return some important field. A straightforward solution is to develop a custom component. But this approach is time and resource consuming, and the component will not be updated via the update system. Instead, you can create a file result_modifier.php in the component template and add a missing field to $arResult. This file (result_modifier.php) is optional.
  • The file style.css with the styles required by the template. The file is applied if a template requires custom styles. The style.css file is included automatically if it exists in the template folder. This file is optional.
  • The file script.js which defines JavaScript required by the template. This file is included in HTML by adding <script src=".../script.js" type="text/javascript"></script>. The script.js file is included automatically if it exists in the template folder. This file is optional.
  • The file .description.php containing the template name and description for the editor. For example, the Menu (bitrix:menu) component has this file defining the template name and description in the component parameters. The .description.php file is optional.
  • The file .parameters.php containing the description of the template input parameters for the editor. For example, the News List (bitrix:news.list) component template had this file defining the template settings in the component parameters (element date, element name etc.). This file is optional.
  • The file template.ext, which is the template itself. The .ext extension depends on the template engine used. The default extension is .php. This file must exist.
  • Any other folders and files containing the resources required by the component, for example: the folder images containing the template images.


Courses developed by Bitrix24