Displaying files in a folder with only a special attribute

Author Message

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

johann savalle

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 09:45:02
Script start
Timing: Jan 19 2025 09:45:02
Module start 'layout'
Timing: Jan 19 2025 09:45:02
Module start 'content'
Timing: Jan 19 2025 09:45:03
Module end 'content'
Timing: Jan 19 2025 09:45:03
Script end

Main resources:

Total runtime0.9455 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 589.4063152.6563
Module start 'layout' 0.00500.0030 742.062539.5078
Module start 'content' 0.00810.9360 781.5703539.1953
Module end 'content' 0.94410.0014 1,320.765612.0938
Script end 0.9454  1,332.8594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3847160.0002
Check MTime0.00120.1318160.0001
Mysql Total
Database connection0.00060.064510.0006
Mysqli_queries0.892094.3461570.0156
Looping result0.00070.0712550.0000
Template Total0.910396.320.4551
Template load0.00250.260720.0012
Template processing0.907896.013120.4539
Template load and register function0.00070.068810.0007
states
state_id_array0.00150.163710.0015
state_identifier_array0.00250.261720.0012
Override
Cache load0.00230.2418190.0001
Sytem overhead
Fetch class attribute can translate value0.00060.063120.0003
Fetch class attribute name0.00160.169240.0004
XML
Image XML parsing0.00090.094320.0004
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00080.0894180.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs