【问题标题】:Ez Publish Class with 3 children how to fetch only one?Ez Publish Class 有 3 个孩子如何只获取一个?
【发布时间】:2015-03-06 15:01:05
【问题描述】:

所以我正在使用 ez Publish。我有一个包含 3 个儿童班的联系人文件夹。

我在头部定义:

{    $contact_node_id = 258
$contact_classes = array('dnd_locations','dnd_textblock','dnd_contactform')
$contact_folder = fetch( 'content', 'node', hash( 'node_id', $contact_node_id ) )
$contact_children = array()
$contact_children_count=fetch_alias( 'children_count', hash( 'parent_node_id', 258,
                                        'class_filter_type', 'include',
                                        'class_filter_array', $contact_classes ) )
}

{if $contact_children_count}
    {set
    $contact_children = fetch_alias( 'children', hash( 'parent_node_id', $contact_node_id,
                                        'offset', 0,
                                        'sort_by', array( 'priority', true() ),
                                        'class_filter_type', 'include',
                                        'class_filter_array', $contact_classes,
                                        'limit', 100 ) )
    }
{/if}

要获取我使用的内容:

    {if $contact_children_count}
    {foreach $contact_children as $index => $child }
        {node_view_gui content_node=$child view=full}
    {/foreach}
{/if}

但随后它会获取所有 3 个孩子的内容。我如何定义它应该只获取第一个?

希望有人可以帮助我。

【问题讨论】:

    标签: html ezpublish


    【解决方案1】:

    您的 fetch 函数中的“限制”就是您要查找的内容。

    所以不是 100,而是使用 1。就是这样

    【讨论】:

      猜你喜欢
      • 2023-01-17
      • 2019-07-06
      • 2014-07-02
      • 2017-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多