Answer the question
In order to leave comments, you need to log in
Why don't links in bitrix.menu work?
I make my own menu, created an infoblock and there I make the names and links of the menu and child elements
Here is the menu template
<?php
/*
* Файл local/templates/.default/components/bitrix/menu/.default/template.php, новый вариант
*/
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
?>
<?php if (!empty($arResult)): ?>
<nav class="mobinav">
<ul class="topmenu">
<?php $previousLevel = 0; ?>
<?php foreach ($arResult as $arItem): ?>
<?php if ($previousLevel && $arItem["DEPTH_LEVEL"] < $previousLevel): ?>
<?= str_repeat("</ul></li>", ($previousLevel - $arItem["DEPTH_LEVEL"])); ?>
<?php endif; ?>
<?php if ($arItem["IS_PARENT"]): /* если есть дочерние элементы */ ?>
<?php if ($arItem["DEPTH_LEVEL"] == 1): /* корневой элемент */ ?>
<li class="root parent<?php if ($arItem["SELECTED"]): ?> <?php endif; ?>">
<a href="<?= $arItem["LINK"]; ?>"class="active-menu"><?= $arItem["TEXT"]; ?> </a>
<ul class="submenu">
<?php else: /* элемент второго, третьего уровня */ ?>
<li class="parent<?php if ($arItem["SELECTED"]): ?> <?php endif; ?>">
<a href="<?= $arItem["LINK"]; ?>"><?= $arItem["TEXT"]; ?></a>
<ul class="submenu">
<?php endif; ?>
<?php else: /* если нет дочерних элементов */ ?>
<?php if ($arItem["DEPTH_LEVEL"] == 1): /* корневой элемент */ ?>
<li class="root<?php if ($arItem["SELECTED"]): ?> <?php endif; ?>">
<a href="<?= $arItem["LINK"]; ?>"><?= $arItem["TEXT"]; ?></a>
</li>
<?php else: /* элемент второго, третьего уровня */ ?>
<li <?php if ($arItem["SELECTED"]): ?> class=""<?php endif; ?>>
<a href="<?= $arItem["LINK"]; ?>"><?= $arItem["TEXT"]; ?></a>
</li>
<?php endif; ?>
<?php endif; ?>
<?php $previousLevel = $arItem["DEPTH_LEVEL"]; ?>
<?php endforeach; ?>
<?php if ($previousLevel > 1): ?>
<?= str_repeat("</ul></li>", ($previousLevel-1)); ?>
<?php endif; ?>
</ul>
</nav>
<?php endif; ?>
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
global $APPLICATION;
$aMenuLinksExt=$APPLICATION->IncludeComponent("bitrix:menu.sections", "", array(
"IS_SEF" => "N",
"ID" => $_REQUEST["ID"],
"IBLOCK_TYPE" => "services",
"IBLOCK_ID" => "179",
"SECTION_URL" => "/#SECTION_CODE_PATH#/",
"DEPTH_LEVEL" => "4",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "3600"
),
false
);
$aMenuLinks = array_merge($aMenuLinksExt, $aMenuLinks);
?>
[8] => Array
(
[TEXT] => Отзывы
[LINK] => /%2Fabout%2F/%2Fabout%2Freviews%2F/
[SELECTED] =>
[PERMISSION] => X
[ADDITIONAL_LINKS] => Array
(
[0] => //about///about/reviews//
)
[ITEM_TYPE] => D
[ITEM_INDEX] => 8
[PARAMS] => Array
(
[FROM_IBLOCK] => 1
[IS_PARENT] =>
[DEPTH_LEVEL] => 2
)
[CHAIN] => Array
(
[0] => Отзывы
)
[DEPTH_LEVEL] => 2
[IS_PARENT] =>
)
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