Forums / Setup & design / How can i count the articales number in main folders ?

How can i count the articales number in main folders ?

Author Message

Selmah Maxim

Sunday 11 May 2003 2:14:36 am

Hi ..

how can i count the artical numebers in all the main folders ?

i mean if i have :

Main Folder
sub folder 1
sub folder 2
sub folder 2.1
sub folder 2.1.1
sub folder 3

Main folder 2
sub folder 1
sub folder 2
sub folder 2.1
sub folder 2.1.1
sub folder 3

now how can i know how much Main folder , Main folder 2 articale have, and the sub folderes also ?

thx.

Jo Henrik Endrerud

Monday 12 May 2003 5:25:56 am

you can count the number of children to a node by the fetch function 'list_count'

example:

{let noOfArticles=fetch('content','list_count', hash('parent_node_id',2))}

this will count all children of the top folder (node 2)

if you only wish to count articles (class 2) the example will be:

{let noOfArticles=fetch('content','list_count', hash('parent_node_id',2,'class_filter_array',array(2),'class_filter_type','include'))}

remember to terminate your {let} when done with the variable

Jo Henrik Endrerud | System Developer @ Seeds Consulting | http://www.seeds.no

Selmah Maxim

Monday 12 May 2003 6:32:50 am

thanks, i`ll try, but as remember i have tryed befor, the problem was it`s counting the folders also !

Selmah Maxim

Tuesday 13 May 2003 10:07:41 am

Henrik ... didn`t work :(

this will count just the main node articales, i need to count also what the childe folders have !
i had tried this also, didn`t work :(:(

{let Count=fetch(content,tree,hash(hash(parent_node_id,16,'class_filter_array',array(2),'class_filter_type','include'))}
{section loop=$Count name=Get}
{let Su=fetch(content,list_count,(hash(parent_node_id,16,'class_filter_array',array(2),'class_filter_type','include'))}
{$Count:Su}
{/let}{/section}{/let}

any one know how ?

Paul Borgermans

Tuesday 13 May 2003 11:51:18 am

Just add a depth of 0. By default only one level down is assumed. Just add it to your parameter array:

..hash(parent_node_id,16,depth,0,'class_filter_array',array(2),'class_filter_type','include')...

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Selmah Maxim

Wednesday 14 May 2003 1:03:18 am

YES :D

thx alot ;)