Skip to the content
Documentation

list

No ratings yet

Summary

Fetches a collection of classes.

Usage

fetch( 'class', 'list', hash( [ 'class_filter', array( class_id | class_identifier [, ...] ) ] ) )

Parameters

Name Type Description Required
class_id integer The ID number of a desired class. No.
class_identifier string The identifier of a desired class. No.
...      

Returns

Array of ezcontentclass objects or FALSE.

Description

This function fetches a collection of classes. The optional "class_filter" parameter can be used to fetch only a given set of classes. This parameter must be either an array of class ID numbers or an array of class identifier strings (in other words: mixing is not possible). If the "class_filter" array is omitted, all classes will be returned.

Examples

Example 1

{def $classes=fetch( 'class', 'list' )}

{foreach $classes as $class}
    {$class.name|wash} <br />
{/foreach}

Outputs the names of all classes.

Example 2

{def $classes=fetch( 'class', 'list', hash( 'class_filter', array( 1, 2, 3 ) ) )}

{foreach $classes as $class}
    {$class.name|wash} <br />
{/foreach}

Outputs the names of class number 1, 2 and 3.

Example 3

{def $classes=fetch( 'class', 'list', hash( 'class_filter', array( 'folder', 'article' ) ) )}

{foreach $classes as $class}
    {$class.name|wash} <br />
{/foreach}

Outputs the names of the classes identified by the strings "folder" and "article".

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.