| Pascal France
                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Tuesday 12 May 2009 7:24:54 am 
                                                                
                                                                 Hi, I have a tree which looks like that: 
level1
  |---item1
         |----child1
         |----child2
         |----child3
  |---item2
         |----child1
         |----child2
  |---item3
         |----child1
         |----child2
         |----child3
Is there a way to fetch, with a single fetch, each first child of each <i>item</i> nodes ? In fact, I would like to create a menu 
|  item1  |  item2  |  item3  |
 where each item is a link to its first child, and I would like to optimize the number of db queries. Pascal Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish
                                                                 | 
                                                
                                                                                                                                                        
                                                        | Michael Fürst
                                                                                                                             | Thursday 14 May 2009 2:36:20 am 
                                                                 Hi, 
Yeah, you are of course able to fetch only the items on level 1. Here's my example of fetching the menu:
 {def $menuTop=fetch( content, list, hash( 	
    parent_node_id, $indexpage,
    sort_by, array('priority',true), 
    class_filter_type, include,
    class_filter_array, array('frontpage','link','contentpage','event_calendar','blog','internal_shortcut','bildergalerie','folder')))
}
$indexpage is the node ID of the root node - in your case "level1". Additionally you can use the "depth" parameter to define how many levels shall be fetched. http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list
 
Cheers,Mike
 |