• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/main.php
  • Класс: CAllMain
  • Вызов: CAllMain::GetNavChain
public function GetNavChain($path=false, $iNumFrom=0, $sNavChainPath=false, $bIncludeOnce=false, $bShowIcons = true)
{
	if($this->GetProperty("NOT_SHOW_NAV_CHAIN") == "Y")
		return "";

	CMain::InitPathVars($site, $path);
	$DOC_ROOT = CSite::GetSiteDocRoot($site);

	if($path===false)
		$path = $this->GetCurDir();

	$arChain = array();
	$strChainTemplate = $DOC_ROOT.SITE_TEMPLATE_PATH."/chain_template.php";
	if(!file_exists($strChainTemplate))
	{
		if(($template = getLocalPath("templates/.default/chain_template.php", BX_PERSONAL_ROOT)) !== false)
		{
			$strChainTemplate = $DOC_ROOT.$template;
		}
	}

	$io = CBXVirtualIo::GetInstance();

	while(true)//until the root
	{
		$path = rtrim($path, "/");

		$chain_file_name = $DOC_ROOT.$path."/.section.php";
		if($io->FileExists($chain_file_name))
		{
			$sChainTemplate = "";
			$sSectionName = "";
			include($io->GetPhysicalName($chain_file_name));
			if($sSectionName <> '')
				$arChain[] = array("TITLE"=>$sSectionName, "LINK"=>$path."/");
			if($sChainTemplate <> '')
			{
				$strChainTemplate = $sChainTemplate;
			}
		}

		if($path.'/' == SITE_DIR)
			break;

		if($path == '')
			break;

		//file or folder
		$pos = bxstrrpos($path, "/");
		if($pos===false)
			break;

		//parent folder
		$path = mb_substr($path, 0, $pos + 1);
	}

	if($sNavChainPath!==false)
		$strChainTemplate = $DOC_ROOT.$sNavChainPath;

	$arChain = array_reverse($arChain);
	$arChain = array_merge($arChain, $this->arAdditionalChain);
	if($iNumFrom>0)
		$arChain = array_slice($arChain, $iNumFrom);

	return $this->_mkchain($arChain, $strChainTemplate, $bIncludeOnce, $bShowIcons);
}