有三个孩子的Ez Publish Class如何只获取一个?

时间:2015-03-06 15:01:06

标签: html ezpublish

所以我正在使用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个孩子的内容。我怎么能定义它应该只取第一个?

希望有人可以帮助我。

1 个答案:

答案 0 :(得分:3)

'限制'在您的获取功能中,您正在寻找。

所以不是100,而是使用1.那就是