| Ulrich L.
                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Tuesday 07 December 2004 2:13:19 am 
                                                                
                                                                 
Hi,I just don't get it... I'm dealing with 'fetch' and the attribute_filter, but obviously there is still a synthax error. Can anybody help me?
 
{let string_node_name=concat("'", $node.name, "'")}
{let cds_by_artist=fetch( 'content', 'list', 
     hash( parent_node_id, 109, depth, 255, 
     class_filter_type, "include", class_filter_array, array(28),
     attribute_filter, array( 237, '=', $string_node_name) ) ) }
This piece of code shall give back all nodes under parent '109' which have the class_id '28' and the class_attribute_id with value of string_node_name.  (Application: I'd like to fetch all CDs by a certain artist, the name of the artist is stored in class_attribute 237).  Perhaps I made a very basic mistake, but I'm really struggling with the documentation on 'fetch' at the moment. However, I'm very impressed what can be achieved.  Hope anybody can help me.  | 
                                                
                                                                                                                                                        
                                                        | Silke Fox
                                                                                                                             | Tuesday 07 December 2004 2:48:35 am 
                                                                 attribute_filter expects an array of arrays as parameter. 
Snippet from this documentation:http://ez.no/ez_publish/documentation/development/libraries/ez_template/operators/data_fetch
 
fetch( 'content', 'list', 
          hash( parent_node_id, $node.node_id, 
                attribute_filter, array( array( 'article/title', '=', 'abc' ) ) ) )
This is because you can specify more than one filter option, like for example 
... attribute_filter, array( array( 'article/id', '>', 100 ), array( 'article/id', '<', 200 ) ) ...
 | 
                                                                                                    
                                                        | Ulrich L.
                                                                                                                             | Tuesday 07 December 2004 6:06:19 am 
                                                                 Thank you, Silke. My solution looks now like this:  
{let cds_by_artist=fetch( 'content', 'list', 
   hash( parent_node_id, 109, depth, 63, 
   attribute_filter, array( array( 237, '=', $node.name ) ) ) ) }
I understand now that filtering an attribute makes it obsolet to filter the class_id first, because the attribute always belongs to a certain class. Is that right? | 
                                                                                                    
                                                        | Silke Fox
                                                                                                                             | Tuesday 07 December 2004 6:18:07 am 
                                                                 Yes, you're right, Ulrich. 
And remember that you can use "class_identifier/class_attribute_identifier" instead of "attribute_id".Improves readability and will still work after moving the class to another system (e.g. with package export/ import), while the ids will probably change.
 | 
                                                                                                    
                                                        | Silke Fox
                                                                                                                             | Wednesday 08 December 2004 12:50:00 am 
                                                                 As far as I know there is no way to avoid node ids completely, but at least you can avoid to use them <i>in templates</i>. 
Have a look at the fetch_alias mechanism http://ez.no/ez_publish/download/changelogs/ez_publish_3_3/template_fetch_by_alias
 http://ez.no/ez_publish/documentation/reference/template_functions/miscellaneous/fetch_alias
 Using this you can change ids in your fetchalias.ini.append while using more descriptive names in the templates. | 
                                                                                                    
                                                        | Silke Fox
                                                                                                                             | Wednesday 08 December 2004 4:55:58 am 
                                                                 
One possibility might be to add a new ini file with the node ids you needand read them from the template with
 
{ezini('[section]','[variable]','[ini file]')}
 |