Views: 1031 (Data available since 06.02.2017)

Task: The site is divided into several sections. The idea is that each section must have its own header in the design. The design has no other changes. What is the best way to implement the change of section headers?

Solution: The component of the "Include Area (for section)" is connected to the template:

<div id="header">
<?$APPLICATION->IncludeComponent("bitrix:main.include", ".default", array(
   "AREA_FILE_SHOW" => "sect",
   "AREA_FILE_SUFFIX" => "headerinc",
   "AREA_FILE_RECURSIVE" => "Y",
   "EDIT_TEMPLATE" => "sect_headerinc.php"
   ),
   false
);?>
</div>

Header code for each section will be stored in the file sect_headerinc.php. The parameter of "AREA_FILE_RECURSIVE" => "Y" means that the same "header" will appear on all subsections of this section, if the parental sect_headerinc.php is not specifically shut off at a lower section level.



Courses developed by «Bitrix», Inc.