Views: 1139 (Data available since 06.02.2017)

By default, the navigation chain point names are managed by the system through the section properties.


Site section header is set in the service file.section.php located in the relevant section. The following variables may be used in this file:

  • $sSectionName - section header;
  • $sChainTemplate - absolute path to navigation chain template (this variable is used very rarely).

Example of the file .section.php:

<?
$sSectionName = "About us";
$sChainTemplate = $_SERVER["DOCUMENT_ROOT"]."/en/about/chain_template.php";
?>

The name of the link to the site section in the navigation chain is specified using the field Section Name in the setup form of the section properties.

The section properties setup form may be accessed as follows:

  • from public section using the "Folder properties" button, located on the administrative panel. This button opens Folder properties form for current site section;

  • from administrative section using the "Folder properties" button, located on the context panel of Site Explorer. This button opens Folder properties form for current folder.

To modify an item of navigation chain edit the value in the Section Name field and save changes.

Information: You can exclude a link to any site section from the navigation chain. To do it, delete this section title from the Section Name field.

Managing navigation chain via the source code

The AddChainItem() function allows adding additional items to the navigation chain. Both static and dynamic values can be used as the navigation chain item.

<?
//--- The first parameter of the function AddChainItem() is the name 
//--- to be shown in the navigation chain; 
//--- the second parameter is the link URL.
//--- Parameter values can be both static and dynamic.
//--- In this example, section name is a static value, while
//--- the link is generated dynamically.
$APPLICATION->AddChainItem("Product details", "catalog.php?BID=".$arIBlock["ID"]."&ID=".$arSection["ID"]);

//--- The next example shows how to generate both parameters dynamically. 
//--- Current name of the catalog section is used as the name.
$APPLICATION->AddChainItem($arSection["NAME"], "catalog.php?BID=".$arIBlock["ID"]."&ID=".$arSection["ID"]);
?>

To display the title of a current page in the navigation chain, call the function AddChainItem() in file footer.php, that is included after the main content is generated.

<?$APPLICATION->AddChainItem($APPLICATION->GetTitle());?>

You can set some of the navigation chain elements to be displayed with no link, as a common text (for example, display the current page title without link):

This elements are creating by adding to the navigation chain template (file chain_template.php) the following code:

if (strlen($LINK)>0)
 $sChainBody .= "<a href="".$LINK."" class='".$strclass."'>".$TITLE."</a>";
else
 $sChainBody .= "<font class='".$strclass."'>".$TITLE."</font>";

Some visual components are able to add to navigation chain the current page or news title, or, for example, catalog item name.

For example, the "Catalog" sequentially adds a catalog sections names according to the catalog structure.

 

Forum and forum themes names are added to the navigation chain the same way.

In this case the navigation chain element name for the current page is defined directly in the document with use of the AddChainItem() function.



Courses developed by «Bitrix», Inc.