Show the children of a folder

Author Message

Christian Lundvang

Friday 26 September 2003 12:43:56 am

Hi.

Somebody who can help me with this?

I have a folder with many subnodes, wich has more subnodes. Like this:

Folder 1
--folder
--folder
---article
----article
-----article
Folder 2
etc...
Is it possible to count all the subnodes of folder 1, and then the subnodes of folder 2?

Thanks in advance

--
Best Regards
Christian Lundvang
http://www.nxc.no

Vivienne van Velzen

Monday 29 September 2003 11:56:24 pm

Hi Christian,

If you just want to count all the subnodes, you could use the fetch command with list_count, like this:

{let xx=fetch(content, list_count, hash(parent_node_id, $folder1.node_id))}

In the example you gave, $xx now has the value 5 (2 folders and 3 articles).
The same could be done for folder 2.
If you just want to count the articles, you'll have to limit your fetch with i.e. a class_filter. If your folders have class id 1, you could try the following:

{let xx=fetch(content, list_count, hash(parent_node_id, $folder1.node_id, class_filter_type, include, class_filter_array, array(1)))}

$xx then has the value 3 (3 articles in the folder Folder1 and the folders with class id 1).

Hope this helps,

Vivienne

Paolo Tramontani

Tuesday 30 September 2003 1:47:09 am

Hi Christian,
if your subnodes are nested in different sublevel (i.e. article is children of folder and folder is children of folder1) you have to user tree_count instead of list_count in the fetch function:
{let list_count=fetch( 'content', 'tree_count', hash( ... ) )}
All the rest remain the same.

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 21:12:21
Script start
Timing: Jan 18 2025 21:12:21
Module start 'layout'
Timing: Jan 18 2025 21:12:21
Module start 'content'
Timing: Jan 18 2025 21:12:21
Module end 'content'
Timing: Jan 18 2025 21:12:21
Script end

Main resources:

Total runtime0.0144 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 587.9141152.6250
Module start 'layout' 0.00590.0026 740.539139.4453
Module start 'content' 0.00850.0042 779.984489.3203
Module end 'content' 0.01270.0017 869.304734.3047
Script end 0.0143  903.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002215.2323140.0002
Check MTime0.00106.9030140.0001
Mysql Total
Database connection0.00085.411910.0008
Mysqli_queries0.002920.519830.0010
Looping result0.00000.069710.0000
Template Total0.001410.010.0014
Template load0.00074.932610.0007
Template processing0.00075.050310.0007
Override
Cache load0.00053.297210.0005
General
dbfile0.00021.713380.0000
String conversion0.00000.041540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs