Forums / Setup & design / How to establish wether or not a content container (like i.e. folder) is empty

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