Выводим древовидное меню из категорий и подкатегорий инфоблока
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
<? //$begin = microtime(true); $rsParentSection = CIBlockSection::GetList( Array('sort' => 'sort', 'sort' => 'asc'), Array('IBLOCK_ID' => 15, 'ACTIVE' => 'Y'), true, Array('UF_*') ); while ($arParentSection = $rsParentSection->GetNext()) {?> <?if($arParentSection["UF_IS_HIDE_MENU"] != 1):?> <?if($arParentSection["DEPTH_LEVEL"] == 1):?> <div class="menu-item"> <?endif?> <?if($arParentSection["DEPTH_LEVEL"] == 1):?> <div class="side-block-text-head"> <a href="<?=$arParentSection["SECTION_PAGE_URL"]?>"> <?=$arParentSection['NAME']?> </a> </div> <?endif?> <ul> <? $arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'],'>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'],'<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'],'>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']); // выберет потомков без учета активности $rsSect = CIBlockSection::GetList(array('left_margin' => 'asc'),$arFilter, true, Array('UF_*')); $el_count = 0; while ($arSect = $rsSect->GetNext()) {?> <li> <a class="menu-item-title" href="<?=$arSect["SECTION_PAGE_URL"]?>"><?=$arSect["NAME"]?></a><span class="menu-item-count"><?=$arSect["ELEMENT_CNT"];?></span> </li> <?}?> </ul> <?if($arParentSection["DEPTH_LEVEL"] == 1):?> </div> <?endif?> <?endif?> <? } //echo microtime(true) - $begin; ?> |