Using fetch() to recurse through a tree

Author Message

Tristan Koen

Friday 25 July 2003 2:51:27 am

Hi All,

I would like to find out if there is any way to make the fetch() function recurse through a tree structure. If I have a folder structure containing articles that look like:

Root Folder
- Article a
- Article b
- Folder 1
- - Article 1a
- - Article 1b
- - Folder 2
- - - Article 2a
- - - Article 2b
Article

I would like a fetch() function that will return
Article 1
Article 2
Article 1a
Article 1b
Article 2a
Article 2b

A nested fetch will not work in my case because
1. The data has to be part of the same resultset (for sorting, etc)
2. The tree can be N levels deep

I am absolutely convinced that this can be done - I just can't figure out how. Any help/suggestions will be fantastic.

Thanks

Tristan

Bjørn Kaarstein

Friday 25 July 2003 4:30:32 am

Have you seen this?

http://ezwiki.blanko.info/index.php/3XHT_TmplObjTree

Regards Bjørn

Roy Viggo Pedersen

Wednesday 30 July 2003 4:33:29 am

Try this example from the demo site (pagelayout_news.tpl):

{let news_list=fetch( content, tree, hash(
parent_node_id, 17,
limit, 5,
sort_by, array( published, false() ),
class_filter_type, include,
class_filter_array, array( 2 )) ) }

Roy

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 18 2025 19:24:34
Script start
Timing: Jan 18 2025 19:24:34
Module start 'layout'
Timing: Jan 18 2025 19:24:34
Module start 'content'
Timing: Jan 18 2025 19:24:35
Module end 'content'
Timing: Jan 18 2025 19:24:35
Script end

Main resources:

Total runtime0.7923 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.4609152.6406
Module start 'layout' 0.00560.0027 742.101639.4766
Module start 'content' 0.00830.7827 781.5781505.2656
Module end 'content' 0.79100.0012 1,286.84388.1406
Script end 0.7923  1,294.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4011160.0002
Check MTime0.00130.1700160.0001
Mysql Total
Database connection0.00070.088110.0007
Mysqli_queries0.744593.9707590.0126
Looping result0.00050.0652570.0000
Template Total0.761496.120.3807
Template load0.00200.255620.0010
Template processing0.759395.839920.3797
Template load and register function0.00010.017210.0001
states
state_id_array0.00080.103810.0008
state_identifier_array0.00110.139020.0006
Override
Cache load0.00170.2152410.0000
Sytem overhead
Fetch class attribute can translate value0.00060.072430.0002
Fetch class attribute name0.00100.120230.0003
XML
Image XML parsing0.00040.050630.0001
class_abstraction
Instantiating content class attribute0.00000.001230.0000
General
dbfile0.00060.0737100.0001
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
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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: 5

Time used to render debug report: 0.0001 secs