Answer the question
In order to leave comments, you need to log in
How to check for a submenu in Bitrix?
It is necessary for me if the menu has a submenu to interpose other code of an output of item'ov of the menu.
Output of menu items:
<?php if(!empty($arResult)): ?>
<div class="nav__menu">
<?php foreach($arResult as $item): ?>
<?if($item["SELECTED"]):?>
<a href="<?= $item['LINK'] ?>" class="menu__item menu__item--active"><?= $item['TEXT'] ?></a>
<?else:?>
<a href="<?= $item['LINK'] ?>" class="menu__item"><?= $item['TEXT'] ?></a>
<?endif;?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<ul class="menu__item menu__item--active">
<?if($item["SELECTED"]):?>
<a href="<?= $item['LINK'] ?>" class="menu__item menu__item--active"><?= $item['TEXT'] ?></a>
<?else:?>
<a href="<?= $item['LINK'] ?>" class="menu__item"><?= $item['TEXT'] ?></a>
<?endif;?>
<?php if (!empty($item['subitems'])): ?>
<?php foreach ($item['subitems'] as $subitem): ?>
<div class="menu__item__list">
<?if($subitem["SELECTED"]):?>
<a href="<?= $subitem['LINK']; ?>" class="item__list item__list--active"><?= $subitem['TEXT'] ?? ''; ?></a>
<?else:?>
<a href="<?= $subitem['LINK']; ?>" class="item__list"><?= $subitem['TEXT'] ?? ''; ?></a>
<?endif;?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question