简体   繁体   English

MODx Wayfinder&level = 2排除所有,但一个

[英]MODx Wayfinder &level=2 exclude ALL but one

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). 我正在尝试编写一个Wayfinder调用级别2,该级别不包括除一个级别2文档(id = 39)之外的所有级别2文档(因此必须包括所有级别1文档)。 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. 我能想到的最好的办法是列出要排除的所有2级文档,但不是很整齐的解决方案。 Also tried using PHx but no success. 也尝试使用PHx,但没有成功。

You could include the single level two resource by giving it a specific template and using the 'where' parameter: 您可以通过为单个二级资源提供特定模板并使用“ where”参数来包括该资源:

[[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. 您还必须为要包含的其他资源添加模板ID。

Only other way I can see would be to have 2 wayfinder calls, one for top level, one for level 2 and use &includeDocs. 我能看到的唯一其他方法是进行2个Wayfinder调用,一个用于顶层,一个用于2级,并使用&includeDocs。

Stucture: 结构:

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

Level 1 One: 1级:

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

Level Two: 第二级:

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

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. 要从Wayfinder(或getResources)中排除整个目录的内容并保持在自动菜单构建意图的自然界限内,请考虑使用Weblink资源作为要隐藏其子级的父目录的代理,然后简单地从菜单中隐藏实际的父目录。

  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 创建一个返回该父目录的Weblink资源,并将其显示为该目录的代理

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. 其中的所有子级(甚至是新子级)仍然井井有条,整洁,“ proxy”网络链接可作为您在菜单中随意表示的一种方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM