M
M
Maxim Shadrin2016-05-04 09:57:04
1C-Bitrix
Maxim Shadrin, 2016-05-04 09:57:04

How to create a submenu in Bitrix?

The question seems banal, but in my case, not everything is so simple. Or I'm just not well informed about this system.
As far as I know, in Bitrix the menu is formed according to the directory structure in the file system, you create a subsection on a specific page, check the box to create a menu, and it appears in the drop-down list.
But here's what I have on the site :
This is how the drop-down menu looks like:
f2a81-clip-301kb.jpg?nocache=1
And this is how the directory structure looks like:
05ba5-clip-67kb.png?nocache=1
I.e. the menu is formed not at all from the directory structure, but how is it formed then?
I need to do a banal thing, create a menu item About the company and name it certificates, but I can't do it. In the structure in general, both "services" and "promotions" and "payment" are inside "about the company", but the menu is formed somehow differently.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
4
4k4, 2016-05-04
@makc9I

As far as I know, in Bitrix the menu is formed according to the directory structure in the file system, you create a subsection on a specific page, check the box to create a menu, and it appears in the drop-down list.
but you can add it yourself, by hand.
The documentation has a detailed description and examples of how to work with the menu.
In a simple case, the menu can be edited through the admin panel (or the file of the desired menu type .*.menu.php in the root of the site).
In a more complex (if a "multi-level" menu is used) - through standard tools or the .*.menu.php file in the root of the site and the .*.menu.php files in subfolders.

A
Ainur Valiev, 2018-12-24
@vaajnur

in Bitrix, you can create a submenu that does not match the section structure by adding

$aMenuLinks = Array(
  Array(
    "пункт 1", 
    "/link1/", 
    Array("/link1/"), 
    Array(
      "FROM_IBLOCK" => 1,
      "IS_PARENT" => 1,
      "DEPTH_LEVEL" => 1
    )
  ),
  Array(
    "подпункт 1", 
    "/sublink1/", 
    Array("/sublink1/"), 
    Array(
      "FROM_IBLOCK" => 1,
      "IS_PARENT" => 0,
      "DEPTH_LEVEL" => 2
    )
  ),
);

where the subclause must follow the parent. paragraph and have an appropriate nesting level

S
Sergey Goryachev, 2016-05-10
@SergeGoryachev

In Bitrix, the menu can be formed by components. That is, you may have a catalog or news folder with an index file that contains a complex component.
And this component takes information from the infoblock which has sections, subsections and elements.
Accordingly, you can set up the menu so that sections/subsections become menu items/sub-items.
And it won't affect the folder structure at all. Everything will be generated dynamically.

M
Mike, 2021-02-25
@mSnus

This is an old question, but I'll answer so I don't forget myself when I need it ))

  1. in header.php or where the menu is included, you need to change the top menu type to horizontal_multilevel:
    <? $APPLICATION->IncludeComponent("bitrix:menu", "horizontal_multilevel", Array(

  2. in .top.menu.php we write
    Array(
        "Пункт, из которого будет выпадать подменю",
        "/parent1/",
        Array(),
        Array(
          "FROM_IBLOCK" => 0,
          "IS_PARENT" => 1,
          "DEPTH_LEVEL" => 1
        ),
        ""
      ),
    /* подменю */
        Array(
          "Первый пункт подменю",
          "/submenu1/",
          Array("/submenu1/"),
          Array(
          "FROM_IBLOCK" => 0,
          "IS_PARENT" => 0,
          "DEPTH_LEVEL" => 2
          ),
          ""
        ),
        Array(
          "Второй пункт подменю",
          "/submenu2/",
          Array("/submenu2/"),
          Array(
          "FROM_IBLOCK" => 0,
          "IS_PARENT" => 0,
          "DEPTH_LEVEL" => 2
          ),
          ""
        ),
    /* конец подменю */

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question