A simple component template can contain the following files and folders.
- Subfolder lang contains subfolders with text messages.
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 /index.php
is to be saved in /lang/en/index.php.
The lang folder is
optional if the component does not use language-dependent messages.
- The file result_modifier.php is included immediately before the
inclusion of 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. Consider 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 the missing field
The file result_modifier.php is optional.
- The file style.css which defines styles required by a
given template. Can be used if the component needs custom non-standard styles.
style.css is included automatically if it exists. This file
- The file script.js contains scripts required by the
template; included via
exists. This file is optional.
- .description.php contains the template name and description for use
in the visual editor. This file is optional.
- .parameters.php contains the description of input parameters for
use in the visual editor. This file is optional.
- The file template.ext is the main file; it contains the template
code. The extension ext depends on the templating language in
which the template is written. php is the default extension.
This file is required.
- Any other files and folders with resources required by the component.