Views: 4840
Last Modified: 10.10.2012

Composite components have been extended with the concept of themes. This concept is similar to the one of a single page template, but as long as the composite components include logics and templates of single page components, the concept of themes is composite. A theme folder of the composite components can contain the following subfolders and files:

  • Subfolder lang containing language-dependent messages. The subfolder names are the abbreviations of languages in which the text messages are stored. As with the component messages, it is a good practice to save a text message file under the same name as a corresponding template file, and store it in the same hierarchy relative to the /lang/language_code/ folder. For example, the file with english messages for /section.php is to be saved in /lang/en/section.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.
  • The file style.css that defines 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 theme name and description for the editor. This file is optional.
  • The file .parameters.php containing the description of the template input parameters for the editor. This file can exist in themes of components that define user-editable template options. This file is optional.
  • Files page_name.ext that are templates of pages of composite components. The .ext extension depends on the template engine. The default extension is .php. Files page_name.ext must exist for each page of a composite component.
  • Templates of simple components which are the constituent parts of composite components. These templates are located in folders /namespace/simple_component_name/ relative to the composite component template folder.
  • Any other folders and files containing the resources required by the component, for example: the folder images containing the images required by the template.
  • Simple components that are parts of composite components are included in templates of composite components pages.

Courses developed by Bitrix24