<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?> <?if (!empty($arResult)):?> <ul id="horizontal-multilevel-menu" class="menu"> <? $previousLevel = 0; foreach($arResult as $arItem): $strImg = ''; if(intval($arItem["PARAMS"]["PICTURE"])>0 && $arItem["DEPTH_LEVEL"]==2){ $img = CFile::ResizeImageGet($arItem["PARAMS"]["PICTURE"], array('width'=>100, 'height'=>100), BX_RESIZE_IMAGE_PROPORTIONAL, false); $strImg = '<img alt="" src="'.$img['src'].'" />'; } ?> <?if ($previousLevel && $arItem["DEPTH_LEVEL"] < $previousLevel):?> <?=str_repeat("</ul></li>", ($previousLevel - $arItem["DEPTH_LEVEL"]));?> <?endif?> <?if ($arItem["IS_PARENT"]):?> <?if ($arItem["DEPTH_LEVEL"] == 1):?> <li class="<?if ($arItem["SELECTED"]):?>active menu-item<?else:?>menu-item<?endif?>"><a href="<?=$arItem["LINK"]?>" class="item"><?=$strImg?><?=$arItem["TEXT"]?></a> <ul class="sub-menu"> <?else:?> <li<?if ($arItem["SELECTED"]):?> class="sub-item item-selected"<?endif?>><a href="<?=$arItem["LINK"]?>" class="parent"><?=$strImg?><?=$arItem["TEXT"]?></a> <?endif?> <li class="sub-item"> <a class="all-item" href="<?=$arItem["LINK"]?>"> Все категории </a> </li> <?else:?> <?if ($arItem["PERMISSION"] > "D"):?> <?if ($arItem["DEPTH_LEVEL"] == 1):?> <li class="<?if ($arItem["SELECTED"]):?>active menu-item<?else:?>menu-item<?endif?>"><a href="<?=$arItem["LINK"]?>" class="item"><?=$strImg?><?=$arItem["TEXT"]?></a></li> <?else:?> ****** <li<?if ($arItem["SELECTED"]):?><?endif?> class="sub-item"><a href="<?=$arItem["LINK"]?>"><?=$strImg?><?=$arItem["TEXT"]?></a></li> ********* <?endif?> <?else:?> <?if ($arItem["DEPTH_LEVEL"] == 1):?> <li class="menu-item"><a href="" class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item item<?endif?>" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$strImg?><?=$arItem["TEXT"]?></a></li> <?else:?> <li class="menu-item"><a href="" class="denied" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$strImg?><?=$arItem["TEXT"]?></a></li> <?endif?> <?endif?> <?endif?> <?$previousLevel = $arItem["DEPTH_LEVEL"];?> <?endforeach?> <?if ($previousLevel > 1)://close last item tags?> <?=str_repeat("</ul></li>", ($previousLevel-1) );?> <?endif?> </ul> <div class="menu-clear-left"></div> <?endif?> 

Good afternoon, ladies and gentlemen.
Tell me how to limit the output of the li item in a complex array; I marked the point with asterisks on both sides. There is a sample from the array, when I try to wrap the string with asterisks in one more array, in general, nothing happens.

    1 answer 1

    A terrible question in terms of incomprehensibility. For such a hell of codemoons dragged to a programmer hell. What does it mean to limit the withdrawal of the item li?
    From what I understand, I can only say that the $arItem["PERMISSION"] will not be displayed if $arItem["PERMISSION"] is less than or equal to "D". But I don’t know how it should be understood. Maybe the condition should be

     $arItem["PERMISSION"]!="D" 

    or

      $arItem["PERMISSION"]== "D" 

    ?

    • For such a hell of codemoons dragged to a programmer hell. ))) I take a note. )) These are multi-level menus, output from the data array, directory -> section -> positions. The cycle displays all positions from the section, I wanted to conclude strictly 20 positions, tried to add another condition with an interruption, but it did not work out, it would then display 20 sections, then 20 directories, then 20 positions of the same type. ))) - Anton Essential