【问题标题】:Wayfinder not respecting &level=`0`?Wayfinder 不尊重 &level=`0`?
【发布时间】:2014-04-05 06:25:58
【问题描述】:

我有以下 Wayfinder 调用:

[[Wayfinder? &startId=`0` &level=`0` &includeDocs=`5,6,7,11,12`]]

这应该显示到列出的资源的链接,这些资源保存在父资源中。但是,他们没有。我可以让它工作的唯一方法是将父资源包含为 startId:

[[Wayfinder? &startId=`3` &level=`0` &includeDocs=`5,6,7,11,12`]]

如果资源都在一个父级下就可以了,但是我有各种级别和父级的各种资源,我无法显示。

有谁知道我做错了什么?

【问题讨论】:

    标签: modx modx-revolution wayfinder


    【解决方案1】:

    如果您指定 includeDocs,它将仅列出这些文档,因此您需要将 startId 设置为您的父级或在 includeDocs 调用中包含必要的父级。

    (wayfinder.class.php 中的第 539 行:)

    /* if set, limit results to specific resources */
    if (!empty($this->_config['includeDocs'])) {
        $c->where(array('modResource.id:IN' => explode(',',$this->_config['includeDocs'])));
    }
    

    【讨论】:

      【解决方案2】:

      http://rtfm.modx.com/extras/revo/wayfinder - 你看到文档了吗?

      &level - Depth (number of levels) to build the menu from. '0' goes through all levels. 
      

      如果您想排除某些文档 - 只需使用 &excludeDocs 属性或过滤 &where,如

      &where=`[{"template:!=": "4"}]` 
      

      (获取除模板“4”之外的所有文档)。 where 条件的文档 - http://rtfm.modx.com/xpdo/2.x/class-reference/xpdoquery/xpdoquery.where

      【讨论】:

      • 是的,我确实读过。如果它工作正常,那么我的第一个示例应该可以工作,因为 startId 和 Level 都设置为 0
      • 谢谢,但我不想排除(有堆),只包括我列出的那些。我原以为我什至不需要 &startId 或 &level 来执行此操作,但我只能通过像第二个示例那样设置它来使其工作。换句话说,&level 和 &includeDocs 似乎不能一起工作。
      • 使用&where,您不仅可以被排除,还可以过滤结果。 &where=`[{"template": "4"}]` - 仅具有模板“4”的文档
      猜你喜欢
      • 1970-01-01
      • 2019-09-13
      • 1970-01-01
      • 2011-04-30
      • 2021-04-15
      • 2014-03-08
      • 1970-01-01
      • 1970-01-01
      • 2017-03-18
      相关资源
      最近更新 更多