R
R
redesupar2021-12-16 14:23:55
PHP
redesupar, 2021-12-16 14:23:55

How to pull out custom properties in the Bitrix menu?

I'm creating a menu, but I can't get a normal LINK, it goes like about/about/review
I decided to add UF_SSILKA, but I don't know how and where to register it, please tell me where exactly should I shove it?

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; ?>


ext.php
<? 
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); 

?>


but the link gives
[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] => 
        )

and links should be about/reviews/ and not //about///about/reviews// or /%2Fabout%2F/%2Fabout%2Freviews%2F/

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question