I have used ultimateparent in the past to set up navigation on a page (eg on the left hand side, navigation for one category). However, when I try and use it on a site with contexts, it goes right up to the root, and counts the context as the ultimate parent, and therefore returns me the "top level" navigation, not the navigation of one section. I guess with contexts I need the penultimate parent.
Anyone know how I get around this?
Do you have site_start in the context's settings?
-
☆ A M B ☆
- 24,524 Posts
When working with contexts, don't overlook the usefulness of creating unique settings for each context, and remember that "web" is only a default context, no more important than your other contexts. Context settings will override global system_settings for that context. This is an extremely important and powerful part of the MODx architecture, and I think too often overlooked.
My issue is in the default web context - I have not actually tested in other contexts yet. My site start is 1.
-
☆ A M B ☆
- 24,524 Posts
The UltimateParent snippet has a property to indicate how many levels from the "top" you want to stop at.
* @example [[UltimateParent? &topLevel=`2`]]
* Will find the ultimate parent of the current document at a depth of 2 levels
* in the document hierarchy, with the root level being level 1.
Thanks Susan! I could have sworn I tried that, with no success, but I just tried again and it worked. Thanks again.