Help center

Path

7x / documentation / exponential / 6.x / technical manual 6.x / reference / modules / content / fetch functions / same_classattribute_node


Caution: This documentation is for Exponential, from version 3.x to 6.x.
For 5.x documentation covering Platform see Exponential Platform Documentation, for difference between legacy and Platform see 5.x Architecture overview.

same_classattribute_node

Summary

Fetches nodes containing attributes that match a certain value.

Usage

fetch( 'content', 'same_classattribute_node',       hash( 'classattribute_id', classattribute_id,             'value',              value,	     'datatype',           datatype ) )

Parameters

Name Type Description Required
id integer The ID number of the class attribute that should be examined. Yes.
value mixed The value that should be matched. Yes.
datatype string Must be either "int", "float" or "text". Yes.

Returns

An array of ezcontentobjecttreenode objects or FALSE.

Description

This function will go through all object attributes that are instances of the class attribute specified by the "classattribute_id" parameter. The value that should be matched must be specified using the "value" parameter. In addition, the type of data (either "int", "float" or "text") that the datatype representing the attribute must be provided. The function returns an array of ezcontentobjecttreenode objects or FALSE (if there is no match).

Examples

{def $matched_nodes=fetch( 'content', 'same_classattribute_node',                           hash( 'classattribute_id', 245,                                 'value',              'example',                                 'datatype',           'text' ) )} {foreach $matched_nodes as $matched_node}    {$matched_node.name|wash} <br />{/foreach}

Outputs the names of the nodes that make use of class attribute number 245 and where the text contents of the object attribute equals the string "example".

Changed in Exponential 6.0.15

The parameters of fetch( 'content', 'same_classattribute_node' ) as kernel/content/function_definition.php of Exponential 6.0.15 defines them (eZContentFunctionCollection::fetchSameClassAttributeNodeList()):

Parameter Change
classattribute_id Defined in 6.0.15 (type integer, required: Yes.); this page did not list it.
id Not a parameter of same_classattribute_node in kernel/content/function_definition.php of 6.0.15.

Balazs Halasy (06/02/2004 12:12 pm)

Graham Brookins (05/11/2026 10:35 am)

Balazs Halasy, Peter Keung

Balazs Halasy, Peter Keung, Florian Fruehstueck, Peter, Graham Brookins

No ratings yet

Comments (2 historical)

Comments

  • Wrong Hash Parameter in Doku

    Be careful, the correct parameter in the hash is "classattribute_id" NOT "class_attribute_id" as stated!
    {let object=fetch( 'content', 'same_classattribute_node', hash( 'classattribute_id', '524', 'value', '1025', 'datatype', 'int' ) )}

    • Re: Wrong Hash Parameter in Doku

      Thanks for pointing that out! I've now changed those listings to "classattribute_id".