Your IP : 3.143.242.169
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?
global $APPLICATION;
$arMenuLinksExt = array();
if(CModule::IncludeModule("iblock") ) {
$IBLOCK_ID = 8; // инфоблок с элементами
$arSections = array();
// echo '<pre>';
$rsParentSection = CIBlockSection::GetByID($_REQUEST['SECTION_ID']);
if ($arParentSection = $rsParentSection->GetNext())
{
$APPLICATION->SetTitle($arParentSection['NAME']);
// print_r($arParentSection);
// выберет потомков без учета активности
// $arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], "ACTIVE"=>"Y",'>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '=DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
$arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], "ACTIVE"=>"Y", '=DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
$rsSect = CIBlockSection::GetList(array('left_margin' => 'asc'),$arFilter);
// print_r($arFilter);
// print_r($rsSect);
while ($arSect = $rsSect->GetNext())
{
// получаем подразделы
// print_r($arSect);
// pre($arSect);
$arMenuLinksExt[] = array($arSect['NAME'], $arSect['SECTION_PAGE_URL'], array(), array(), "");
}
}
// echo '</pre>';
if(count($arMenuLinksExt) < 1){
$arOrder = Array("SORT"=>"ASC");
$arSelect = Array("ID", "NAME", "IBLOCK_ID", "DETAIL_PAGE_URL");
$arFilter = Array("IBLOCK_ID"=>$IBLOCK_ID, "ACTIVE"=>"Y");
if(isset($_REQUEST['SECTION_ID'])){
$arFilter['SECTION_ID'] = $_REQUEST['SECTION_ID'];
}
$res = CIBlockElement::GetList($arOrder, $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement()) // наполнение массива меню пунктами меню
{
$arFields = $ob->GetFields();
$arMenuLinksExt[] = Array(
$arFields['NAME'],
$arFields['DETAIL_PAGE_URL'],
Array(),
Array(),
""
);
}
}
}
$aMenuLinks = array_merge($arMenuLinksExt, $aMenuLinks); // меню сформировано