MODx Wayfinder &level=2 exclude ALL but one

607 views Asked by At

I am trying to write a Wayfinder call level 2 that excludes ALL level 2 docs except one level 2 doc (id=39) (so ALL level 1 docs have to be included). How to achieve that?

[[Wayfinder? &startId=`0` &level=`2` excludeDocs=`3,4,5,6,7,8,9` &outerTpl=`menu`]]

The best I could come up with was to list ALL level 2 docs to exclude, not very neat solution. Also tried using PHx but no success.

3

There are 3 answers

2
David Pede On BEST ANSWER

Only other way I can see would be to have 2 wayfinder calls, one for top level, one for level 2 and use &includeDocs.

Stucture:

-Resource 1
-Resource 2
    -Resource 3
    -Resource 4
-Resource 5
    -Resource 39 (just inc this resource)
-Resource 7

Level 1 One:

[[Wayfinder?
&startId=`0`
&level=`1`
&outerTpl=`menu`]]

Level Two:

[[Wayfinder?
&startId=`2,5`
&level=`1`
&includeDocs=`39`
&outerTpl=`menu`]]
1
David Pede On

You could include the single level two resource by giving it a specific template and using the 'where' parameter:

[[Wayfinder? &startId=`0` &level=`2` &where=`{"template:IN":[1,2,3]}` &outerTpl=`menu`]]

You would have to add the template id's for the other resources you want included as well.

0
Trae Nickelson On

To exclude the contents of an entire directory from Wayfinder (or getResources) and stay within the natural boundaries of the intent of automatic menu building, consider using a Weblink resource as a proxy for the parent directory whose children you wish to hide, and then simply hide the actual parent directory from menus.

  1. Mark the Parent Directory whose children you wish to hide as "Hide from Menus"
  2. Create a Weblink Resource back to that Parent directory and have it display as a proxy back to that directory

The actual parent directory remains nice and neat. Any children within it (even new ones) are still organized and neat, and the "proxy" weblink serves as a way to represent it however you want in the menus.