Forums / General / Displaying files in a folder with only a special attribute
johann savalle
Tuesday 21 June 2005 6:03:42 am
Hello,
the following code
{let test=fetch(content,list,hash(parent_node_id,15232))} {section name=MyList loop=$test} {node_view_gui view=line content_node=$MyList:item}<br> {/section} {/let
display the content of a folder.How can I do to display only objects from this folder which have the attribute "title" set to "plop", for instance ?
regards, johann
Thursday 23 June 2005 8:44:54 am
mm, okay, I found out the filtering possibilities of fetch, but it doesn't work :s I dunno where I went wrong, here is the code :
{let mylist=fetch(content, tree, hash(..., class_filter_type, 'include',class_filter, array('lesson_text'))} {section name=filtering loop=$mylist} {node_view_gui view=line content_node=$filtering:item}<br> {/section} {/let
Łukasz Serwatka
Thursday 23 June 2005 12:54:49 pm
Hi Johann,
I suggest to enable DebugOutput for development, then you can easly find errors in template syntax for example. Also better is use "var" parameter instead of "name" when you using section. var defines a variablename for the iterator. You should use 'class_filter_array' instead of 'class_filter'
After small corrections your code will be:
{let data=fetch( 'content', 'tree', hash( 'parent_node_id', <node_id>, 'class_filter_type', 'include', 'class_filter_array', array( 'lesson_text' ) ) )} {section var=node loop=$data} {node_view_gui view=line content_node=$node} {/section} {/let}
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog