Bitrix Site Manager

CMain::ShowNavChain

CMain::ShowNavChain(
 mixed path = false,
 int start_from = 0, 
 mixed template_path = false
)

The method ShowNavChain emits the navigation chain.

This method utilizes the delay function technology allowing to add items to the navigation chain after the site prologue is emitted.

If you do not want some page to display the navigation chain, simply initialise the page property NOT_SHOW_NAV_CHAIN with "Y":

$APPLICATION->SetPageProperty("NOT_SHOW_NAV_CHAIN", "Y");

The method ShowNavChain supports this property and respects its value

Parameters

ParameterDescription
path Path for which the navigation chain is to be built. In case of multiple sites, if the DOCUMENT_ROOT of the site is different, pass an array in the following format:
array("Site ID", "Path")
Optional. False by default, which means the current site.
start_from Ordinal of item from which to build the chain.
Optional; zero by default.
template_path Path to the navigation chain template.
Optional. The default value is false, which implies searching for the navigation chain template using the algorithm described in the Navigation chain section.

See Also

Example



<?
// display navchain on the current page 
// starting from the first item 
// using the template "chain_template.php"
// located in either "/bitrix/templates/<current site template>/", 
// or "/bitrix/templates/.default/".
$APPLICATION->ShowNavChain();
?>
<?
// display navchain on the current page 
// starting from the second item 
// using the template chain_template_bottom.php
$APPLICATION->ShowNavChain(false, 2, 
                           "/bitrix/templates/.default/chain_template_bottom.php");
?>

Example of the navigation chain template:


<?
// file /bitrix/templates/.default/chain_template.php

$sChainProlog = "";   // HTML before the navchain
$sChainBody = "";     // navchain item
$sChainEpilog = "";   // HTML after the navchain

// separator
if ($ITEM_INDEX > 0)
   $sChainBody = "<font class=\"chain\">&nbsp;/&nbsp;</font>";

// if the link exists
if (strlen($LINK)>0)
{
    // display link
    $sChainBody .= "<a href=\"".$link."\" class=\"chain\">".
                   htmlspecialchars($TITLE)."</a>";
}
else // otherwise
{
    // text
    $sChainBody .= "<font class=\"chain\">".htmlspecialchars($TITLE).
                   "</font>";
}
?>