How to establish wether or not a content container (like i.e. folder) is empty

Author Message

Felix Laate

Monday 06 December 2004 2:41:16 pm

Hi all!

I'm looping through a list of folders to crate a javascript/css menu structure and I would need to know how to establish wether ornot those folders are empty.

Is there a attribute for this? Or a fuction? Or some other magic way?

Cheers

felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Tore Skobba

Monday 06 December 2004 10:30:03 pm

Fetch the children as count and then do an section show on the number of children... Pseudo code:

{let number_children=fetch(content,count,hash(parent_node_id,$node_id))}
{section show $number_children.nq(0)}
do your work on the children
{/section}
{/let}

My syntax is probably wrong, do some search on EZ to find the correct one.

Cheers
Tore

Ɓukasz Serwatka

Monday 06 December 2004 11:31:25 pm

Felix,

{let children=fetch(content,list,hash(parent_node_id,$node.node_id))}
    {section show=$children loop=$children}
        {$:item.name}
    {section-else}
        You don`t have any children
    {/section}
{/let}

You can use {section} as "If" instructions.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Felix Laate

Monday 06 December 2004 11:46:20 pm

Thanks guys!

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Bruce Morrison

Monday 06 December 2004 11:53:21 pm

Even easier if you have already fetched the node:

$node.children_count

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

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 20 2025 09:02:25
Script start
Timing: Jan 20 2025 09:02:25
Module start 'layout'
Timing: Jan 20 2025 09:02:25
Module start 'content'
Timing: Jan 20 2025 09:02:25
Module end 'content'
Timing: Jan 20 2025 09:02:25
Script end

Main resources:

Total runtime0.0164 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 590.7656152.6875
Module start 'layout' 0.00550.0031 743.453139.5234
Module start 'content' 0.00860.0057 782.976693.5547
Module end 'content' 0.01430.0021 876.531334.3047
Script end 0.0164  910.8359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002615.7332140.0002
Check MTime0.00116.5806140.0001
Mysql Total
Database connection0.00074.213110.0007
Mysqli_queries0.002615.736130.0009
Looping result0.00000.146410.0000
Template Total0.001710.210.0017
Template load0.00095.776010.0009
Template processing0.00074.408810.0007
Override
Cache load0.00074.129010.0007
General
dbfile0.00116.854780.0001
String conversion0.00000.060940.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