ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

object_list

Summary

Fetches objects that belong to certain section.

Usage

fetch( 'section', 'object_list',
       hash( 'section_id', section_id,
           [ 'offset',     offset,    ]
           [ 'limit',      limit,     ]
           [ 'sort_order', sort_order ]
           [ 'status',     status     ] ) )

Parameters

NameTypeDescriptionRequired
section_id integer The ID number of the target section. Yes.
offset integer The offset to start at. No.
limit integer The number of objects that should be fetched. No.
sort_order array The desired sorting order. No.
status string The status of the target objects ('published' by default). No.

Returns

An array of ezcontentobject objects or FALSE.

Description

This function fetches a set of objects that belong to a certain section. The section must be specified by its ID number using the "section_id" parameter. The "offset", "limit" and "sort_order" parameters work in the same way as in the list fetch function of the "content" module.

The optional "status" parameter can be used to specify the status of objects that should be fetched. If this parameter is omitted or set to "published", the function will fetch all published objects that belong to the specified section. If set to "archived", the archived (moved to the trash) objects that belong to the specified section will be fetched. (Note that fetching all draft objects that belong to a certain section is not supported.)

The function returns an array of ezcontentobject objects. If no objects can be found, or if the provided section ID number is invalid, FALSE will be returned.

Examples

Example 1

{def $objects=fetch( 'section', 'object_list',
                     hash( 'section_id', 13 ) )}
 
{foreach $objects as $object}
{$object.name} <br />
{/foreach}

Outputs the names of the published objects that belong to section number 13.

Example 2

{def $objects=fetch( 'section', 'object_list',
                     hash( 'section_id', 5,
                           'status', 'archived' ) )}
 
{foreach $objects as $object}
{$object.name} <br />
{/foreach}

Outputs the names of the objects that belong to section number 5 and are moved to the trash.

Balazs Halasy (04/10/2004 1:35 pm)

Julia Shymova (12/07/2007 11:41 am)

Balazs Halasy, Julia Shymova


Comments

There are no comments.