V
V
Vadim Timoshenko2019-10-31 13:01:39
1C-Bitrix
Vadim Timoshenko, 2019-10-31 13:01:39

How to add sub-items to the Bitrix menu?

I don't want to ask stupid questions at all. But for the 2nd hour I can’t understand how the menu system works in Bitrix.
There is a menu:
5dbab062d661c537907659.png
I see that I can edit the main items.
5dbab08cd6013237408838.png
But I can't find how to add sub-items.
The only thing I have seen is the creation of menu items when creating a folder. But the folders are already created. Somewhere there should be an item adding a page to the submenu for the main item?
5dbab0ed93d52478756054.png
Of course, I also have an array of menus:

<?
$aMenuLinks = Array(
  Array(
    "О гостинице", 
    "/company/", 
    Array(), 
    Array(), 
    "" 
  ),
  Array(
    "Размещение", 
    "/rooms/", 
    Array(), 
    Array(), 
    "" 
  ),
  Array(
    "Инфраструктура", 
    "/infrastruktura/", 
    Array(), 
    Array(), 
    "" 
  ),
  Array(
    "Контакты", 
    "/contacts/", 
    Array(), 
    Array(), 
    "" 
  )
);
?>

But the rest of the sub-items are not added through the array ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Kirshin, 2019-10-31
@PbI6A_KuT

Look, according to the standard, there are like two types of menus, top and left. You can also add your own in the settings of the "Structure Management" module. Read about component settings here https://dev.1c-bitrix.ru/user_help/components/sluz...

"ROOT_MENU_TYPE" => "top", // это для 1 уровня
"MAX_LEVEL" => "2", // нам надо 2 уровня вложенности, соответственно два. 
"CHILD_MENU_TYPE" => "left", // эт для всех остальных уровней вложенности

OK. With level 1, everything is clear, it usually lies right in the root of the site with the name top.menu.php.
But the second level you need to create in the section you are interested in. For example, in the menu level 1 you have a link to /catalog/ , so that the catalog has sub-items, you need to go to the /catalog/ folder and create left.menu.php there. It looks the same as top.menu.php
If you do not need to set links statically in the file, but so that they are formed automatically from sections, then left.menu.ext.php is created. The bitrix:menu.sections component is placed inside it, you customize it and so on as you need in result_modifier.php and in the settings of your main bitrix:menu you also specify
"USE_EXT" => "Y",

Y
Yaroslav Alexandrov, 2019-10-31
@alexyarik

In the "/company/" folder, create a left menu, i.e. section (green button create), add the necessary sub-items in this section menu.
In the settings of the menu component, set the nesting, and the menu type is left (Menu type for other levels)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question