Views: 6223
Last Modified: 16.04.2014

Managing navigation chain via the system interface

By default, the system provides users tools for managing navigation chain items with use of site section properties. The navigation chain item name is defined by the site section (reference to which this item contains) title. A section title can be defined in the Folder Properties form (for corresponding folder).

You can open this form the following ways:

  • 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 Title 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 Title 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 Bitrix24