pdoMenu multi-level

Good day. I ask for help, I can not implement a multi-level menu.
Need menu
1.Video surveillance
1.1 Video cameras
Camera IP - Transition
HD cameras - transition
1.2 DVRs
IP DVRs - transition
HD DVRs - transition
It is also necessary that the active category be expanded.
A parent that contains resources and not a category didn’t show them

[[pdoMenu?
&depth=`3`
&parents=`3`
&firstClass=`0`
&lastClass=`0`
&parentClass=`dropdown`
&outerClass=`nav navbar-nav` &levelClass=`submenu`
&tplOuter=`@INLINE <ul class="category-list clearfix">[[+wrapper]]</ul>`
&tplInner=`@INLINE <ul class="dropdown-menu">[[+wrapper]]</ul>`
&tplParentRow=`@INLINE <li [[+classes]]><a class="dropdown-toggle" data-toggle="dropdown" href="[[+link]]" [[+attributes]]>[[+menutitle]]<span class="caret"></span></a>[[+wrapper]]</li>`
]]
  1. tmk-pilot. ru/videonablyudenie/

What exactly is not working in your setup?


&depth is not a property, you should be using &level instead. Although the default of &level is set to 0 which is infinite depth, so probably not an issue for you.

Not sure why you would want those class names to be named 0. If you want to remove them, you can just leave them empty:

&firstClass=``
&lastClass=``

You can define a class name for any active items or categories with &hereClass (defaults to active). If you want to have your active items expanded, you have to handle that using CSS.


Not exactly sure what you mean by this, but if you are trying to show some resources or parents and some not, you can also exclude resources with the &resources property or even all resources with specific templates with the &template property by putting a hyphen in front of the ID:

&resources=`-3`
// will not show the resource with ID 3

&templates=`-5`
// will not show resources with template ID 5

For more have a read in the documentation (also available in russian).
There’s plenty more properties that might help you.

1 Like

Do you use custom javascript code to show/hide your submenus or do you use a framework like (for example) Bootstrap for the menu?

If you have custom javascript code, then you may have to adjust the code to work with your menu structure.

If you use a framework, work out how the html-markup of the menu should be, then try to create this exact markup by adjusting the different templates (&tplParentRow, &tplInner) of your pdoMenu call.

Hello. I usually use ready-made templates. This time the template did not have a vertical menu of several levels. I used what’s on our web with Bootstrap. I could not finish it and switched to Wayfinder.
Wayfinder did partially what was needed. I don’t know how to do what needs to be done.

Hello.
I need a menu

  1. Opening on the catalog page when clicking categories and subcategories
  2. What would be expanded on the current category page and show subcategories

pdoMenu is practically identical to Wayfinder. If the output of Wayfinder gives you a different result, then probably because you used different templates in the snippet call.

pdoMenu/Wayfinder is used to convert your resource-tree into some html-markup. If you need help creating some specific markup, then maybe we can help you here in this forum.

If the problem however is the opening/closing of submenus with Javascript/CSS, then this is not directly related to MODX and pdoMenu. But you should be able to find a lot of information about JS/CSS on the internet.

The code I posted works.
I do not understand what needs to be done to get the menu of the desired type and levels. As in the screenshot
2022-08-09_160723

Honestly, I think we are treading water here.

I still don’t know what exactly you want.
Do you don’t know how to get the required html-markup output from pdoMenu or is it just a Javascript/CSS issue?

Posting a printscreen of your website doesn’t help.
Please be more specific and describe in detail what the actual problem is.

The mega-menu here has many levels. The only way I could make it work was to have a separate Wayfinder tag for each of the Top Menu items.

The way I always code complicated menus is by starting with the html hard-coded into the template, so I can make sure that the structure of the menu works as intended. After that I begin to figure out which parts of the structure to include in each of the templates available in pdoMenu (or Wayfinder or getResources).

In order for people to help you here, we need to see the actual HTML you want to get as the result. Not a screenshot, we need to see each tag and class and attribute and level. Then we can start to help you figure it out.

3 Likes

Hello. Sorry, was on the road.
I made Wayfinder. Standard chunks Wayfinder - Школа MODX. already added further. Works as long as it’s acceptable.
Thank you all for your help