Path / documentation / ez publish / technical manual / 4.x / reference / modules / content / fetch functions / same_classattribute_node

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



Fetches nodes containing attributes that match a certain value.


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


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.


An array of ezcontentobjecttreenode objects or FALSE.


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).


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

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".

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

Peter Keung (05/02/2009 7:06 pm)

Balazs Halasy, Peter Keung


  • 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".