📜 ⬆️ ⬇️

Wayfinder + UltimateParent = separate display of menus and submenus

image This link solves a small, but in the context of Wayfinder, an important task: it displays correctly the menu and submenu separately.

I spent two days searching for this solution until I found the answer on the official MODx forum. I want to share with you a free translation of this solution (original modxcms.com/forums/index.php?topic=34773.0 ).

The bottom line:

I need to bring up the main menu, and under it a submenu, clearly it looks like this:
')


Decision:

Display the menu: [[Wayfinder? StartId = `0` & config =` nunnauuni`]]
and now the submenu: [! Wayfinder? & startId = `[[UltimateParent]]` & config = `nunnauuni_sub`!]

Some may ask, “Why can't I just output two times [[Wayfinder? StartId =` 0` & config = `nunnauuni`]] [[Wayfinder? StartId =` [* id *] `& config =` nunnauuni`]]? "
I answer that you can, but if you go deep into the menu, the submenu will be lost.

PS: I keep all the settings in the Wayfinder config (/assets/snippets/wayfinder/configs/nunnauuni.config.php), it turned out to be more convenient for me. I give its source code, it may be useful to someone:

<?php
$level = 0;
$hideSubMenus = 1;
$outerClass = 'menu' ;
$firstClass = 'first' ;

$outerTpl = '@CODE:<ul id="mainmenu">[+wf.wrapper+]</ul>' ;
$rowTpl = '@CODE:<li><a href="[+wf.link+]" [+wf.classes+]>[+wf.linktext+]</a></li><li class="sep[+wf.classnames+]" style="float: left"></li>' ;

?>


* This source code was highlighted with Source Code Highlighter .

Source: https://habr.com/ru/post/66870/


All Articles