A
A
Alexander Sinitsyn2016-05-07 11:17:21
1C-Bitrix
Alexander Sinitsyn, 2016-05-07 11:17:21

How to put menu template in composite mode?

Tell me how to make the menu composite?
I figured it out with Yandex maps and other things ... where there is no point in dynamic content, I just added $this->setFrameMode (true) everywhere.
Only the menu that Composite was rejected was left ... and here it’s somehow not entirely clear. Probably, it is necessary to surround the condition with a rights check with a dynamic frame, but how to do it correctly.

<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<?if (!empty($arResult)):?>
<ul class="top-menu-list">
<?
$previousLevel = 0;
foreach($arResult as $arItem):?>

  <?if ($previousLevel && $arItem["DEPTH_LEVEL"] < $previousLevel):?>
    <?=str_repeat("</ul></li>", ($previousLevel - $arItem["DEPTH_LEVEL"]));?>
  <?endif?>

  <?if ($arItem["IS_PARENT"]):?>

    <li class="top-menu__item animation <? if ($arItem["SELECTED"]): ?>active<? endif ?>"><span class="top-menu__highlight"><a href="<?=$arItem["LINK"]?>" class="link" title="<?=$arItem["TEXT"]?>"><?=$arItem["TEXT"]?></span></a>
      <ul class="sub-menu">

  <?else:?>

    <?if ($arItem["PERMISSION"] > "D"):?>

      <?if ($arItem["DEPTH_LEVEL"] == 1):?>
        <li class="top-menu__item animation <? if ($arItem["SELECTED"]): ?>active<? endif ?>"><span class="top-menu__highlight"><a href="<?=$arItem["LINK"]?>" class="link" title="<?=$arItem["TEXT"]?>"><?=$arItem["TEXT"]?></span></a></li>
      <?else:?>
        <li class="sub-menu__item <? if ($arItem["SELECTED"]): ?>active<? endif ?>"><a href="<?=$arItem["LINK"]?>" class="link" title="<?=$arItem["TEXT"]?>"><?=$arItem["TEXT"]?></a></li>
      <?endif?>

    <?else:?>
    
      <?if ($arItem["DEPTH_LEVEL"] == 1):?>
        <li class="top-menu__item animation <? if ($arItem["SELECTED"]): ?>active<? endif ?>"><span class="top-menu__highlight"><a href="<?=$arItem["LINK"]?>" <?=GetMessage("MENU_ITEM_ACCESS_DENIED")?> class="link"><?=$arItem["TEXT"]?></span></a></li>
      <?else:?>
        <li class="sub-menu__item <? if ($arItem["SELECTED"]): ?>active<? endif ?>"><a href="<?=$arItem["LINK"]?>" <?=GetMessage("MENU_ITEM_ACCESS_DENIED")?> class="link"><?=$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>
<?endif?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Kornev, 2016-05-19
@webkornevand

$this->setFrameMode(true)
This is a composite vote. If at least one component or template voted against, the composite will not work on the page. For the menu, it’s enough to call this function because I don’t see the point in pulling it up.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question