Count nodes

Author Message

Arash Molavi

Wednesday 19 November 2003 9:01:08 am

How do i count and print out nodes that are in a folder?

Marco Zinn

Wednesday 19 November 2003 12:09:14 pm

You can use this template snippet to count all children of Class 2 (this usually is "article") in the current node.

{let articles_count=fetch('content','list_count',
hash(parent_node_id,$node.node_id,
class_filter_type,"include",
class_filter_array,array(2)))}

This Node has {$article_count} articles.

Also see here: http://ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/one_article_folder
and here
http://ez.no/developer/ez_publish_3/documentation/development/libraries/ez_template/operators/data_fetch

Marco
http://www.hyperroad-design.com

Arash Molavi

Thursday 20 November 2003 1:08:23 pm

Saw that minutes after I posted this topic. But when caching the override file it only prints out "Array"

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:08:44
Script start
Timing: Jan 18 2025 19:08:45
Module start 'layout'
Timing: Jan 18 2025 19:08:45
Module start 'content'
Timing: Jan 18 2025 19:08:45
Module end 'content'
Timing: Jan 18 2025 19:08:45
Script end

Main resources:

Total runtime0.0276 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.0104 589.2266152.6094
Module start 'layout' 0.01040.0050 741.835939.3984
Module start 'content' 0.01550.0097 781.234489.2578
Module end 'content' 0.02510.0025 870.492234.3047
Script end 0.0276  904.7969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002810.2892140.0002
Check MTime0.00124.4520140.0001
Mysql Total
Database connection0.00165.747510.0016
Mysqli_queries0.005620.401630.0019
Looping result0.00000.115610.0000
Template Total0.00207.110.0020
Template load0.00124.175210.0012
Template processing0.00082.944410.0008
Override
Cache load0.00093.150610.0009
General
dbfile0.00031.060880.0000
String conversion0.00000.035440.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