Share » Forums » General » Get page child item count?

Get page child item count?

Get page child item count?

Monday 04 October 2004 2:48:20 am - 2 replies

Modified on Monday 04 October 2004 2:48:41 am by Edward Eliot

Author Message

Frederik Holljen

Monday 04 October 2004 4:39:31 am

It's the count of that fetch you want right? Can't you just fetch in into a variable with let and then use array_count on it?

Mark Marsiglio

Monday 04 October 2004 4:56:18 am

I handled the related items this way:

{let related=$node.object.data_map.keywords.content.related_objects}
{section show=$related}

 {switch match=$related}
 {case match=''}

 {/case}
 {case}
<h3>Related documents</h3> 
{/case}
 {/switch}
<ol>
{section name=Related loop=$related}
<li class="relateditem"><a href={$:item.url_alias|ezurl}>{$:item.name}</a> <span class="relateditemclass"><nobr>{$node.object.class_name|wash}</nobr></span></li>
{/section}
</ol>
{/section}
{/let}

This tells the section title (related objects) to display only if there are items under it.

Another way to do it would be to repeat your fetch for related items but substitute list_count for list, and assign that to a variable.

...count=fetch('content','list_count',hash(parent_node...

This will return the total number of items that match the fetch criteria which you can use in a section show command.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu