Answer the question
In order to leave comments, you need to log in
How to display the 3rd level of the bitrix menu?
Hello. I'm starting to deal with bitrix and got into a stupor, how to display the 3rd level of the menu. Haven't found an answer on google.
Menu output component in header.php. Where to start, tell me?
<? $APPLICATION->IncludeComponent("bitrix:menu", "top", Array(
"ROOT_MENU_TYPE" => "top",
"MAX_LEVEL" => "3",
"CHILD_MENU_TYPE" => "sub",
"USE_EXT" => "Y",
"DELAY" => "N",
"ALLOW_MULTI_SELECT" => "N",
"MENU_CACHE_TYPE" => "A",
"MENU_CACHE_TIME" => "3600",
"MENU_CACHE_USE_GROUPS" => "N",
"MENU_CACHE_GET_VARS" => ""
)
); ?>
<nav class="top-menu">
<div class="menu-main-container">
<ul id="navigation" class="navigation">
<? $p = 1; ?>
<? foreach ($arResult as $item):
/*echo '<pre>';
var_dump($arResult);*/
?>
<? if (($item['DEPTH_LEVEL'] == 1) && ($p == 2)): ?>
</ul>
</li>
<? endif; ?>
<? if ($item['IS_PARENT']): ?>
<li class="menu-item-has-children">
<a href="<?= $item['LINK'] ?>"><span
class="nav_bg_clr"></span><span><?= $item['TEXT'] ?></span></a>
<ul class="sub-menu">
<? $p = $item['DEPTH_LEVEL']; ?>
<? endif; ?>
<? if (($item['DEPTH_LEVEL'] == 1) && (!$item['IS_PARENT'])): ?>
<li><a href="<?= $item['LINK'] ?>"><span
class="nav_bg_clr"></span><span><?= $item['TEXT'] ?></span></a>
</li>
<? $p = $item['DEPTH_LEVEL']; ?>
<? endif; ?>
<? if ($item['DEPTH_LEVEL'] == 2): ?>
<li>
<a href="<?= $item['LINK'] ?>"><span><?= $item['TEXT'] ?></span></a>
</li>
<? $p = $item['DEPTH_LEVEL']; ?>
<? endif; ?>
<? endforeach; ?>
</ul>
</div>
<div class="cl"></div>
</nav>
Answer the question
In order to leave comments, you need to log in
Add
<? if ($item['DEPTH_LEVEL'] == 3): ?>
<?= $item['TEXT'] ?>
<? $p = $item['DEPTH_LEVEL']; ?>
<? endif; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question