I feared that might be the case… How easy is it to assign a root node to a listing via a metadata value? Can you just use a keyword in the Dynamic Parameters? Something like:
Thanks Bart. That tutorial was ideal. Have figured that out. One more question…is there a way in Matrix to show the active asset in the list the same way menu_normal would i.e. a way to replicate “settings.class.current”?
You’re right though, there probably should be a way with conditions or modifiers. I’ll have a play and come back if I’ve figured it out or reach a dead end.
OK I can get pretty close with this but unfortunately it shows all list items as active. The condition is just on the current asset being true so it gives the active class to all assets in the list on every page
I’m struggling with this exact thing at the moment! I’m on 5.3.4.0
I can get this conditional keyword to work:
%begin_asset_assetid^eq:910638%
So I can get a class output only when viewing page 910638
But if I try and match the asset to the actual global asset, the keyword condition breaks and it shows for all pages.
I guess because it’s in the default type format for the asset listing - mine is anyway. So there will always be one true asset in the nav which applies the class to all the others. There needs to be a way of current asset only…it looks like the frontend asset cover this…
It’s probably straight forward to make a javascript solution but would be nice to use Matrix if possible.
Yea my bad…I forgot that my suggestion won’t work for this scenario…
Yep, it’s pretty much the reason the frontend asset keyword was made.
%globals_X% keywords are all evaluated later in the processing of the page. So matrix will first evaluate all asset based keywords in the context of where they are printed, so for asset listing type format for example, it needs to do things like %asset_name% at the time it lists that asset, it will leave %globals_x till the end.
So when you do those types of condition checks, it will not do the checks properly because it’s basically checking if the evaluated keyword of %asset_assetid% matched the string %globals_asset_assetid%, not the evaluated keyword at that point.
The easiest other alternative I can think of is to pipe the asset listing through a REST asset where you can do some Server Side JS on the output of it and then print your menu that way?
Thanks for that explanation and confirmation that its not just me getting my keyword replacements wrong!
Fundamentally for me, this example is another one that I’m having to ‘work around’ because menus are part of the design area and can’t be nested in.
This site isn’t that complex in terms of its grid code, but it has a few variations using quite different grid structures for the main page body, that will make putting that menu into the design and then having all the other grid code before and after it change for different customisations really tricky to implement. The only way I could do it would be to have pages with opening divs nested in, and then others with closing divs nested in, and that’s just really not good practice splitting up div code like that.
I need the functionality of a true menu area, but I also need the flexibility to not have to put that into a design file. A menu area that could be nested in, alongside all its wrapping divs, that would really be useful!
Can you explain a bit more about what you mean? So your issue is not really about setting a dynamic root node for the menu, it’s more about the formatting of each menu item?
Is this something you might still be able to do with keyword modifiers on the print tag value of each menu item?
Keen to understand the issue more so that we can maybe come up with an alternative solution.