how to build a table

Author Message

Alain Mangana

Wednesday 22 October 2008 4:47:02 am


I want to create a table which I add value. Here is my code :

{def $articles=fetch( content, list, hash( 'parent_node_id' , 2,
sort_by, $node.sort_array,'depth', 3,'class_filter_type', 'include', 'class_filter_array', array( 'experience' )
))}


{def $compteur = 0}

{def $objet= array()}

{foreach $articles as $article}

{def $objet[$compteur] = $article}

{def $compteur = inc( $compteur )}

{/foreach}
{undef}
but I can not have the table $objet. is it that someone has an idea

http://tikdem.com
/

André R.

Wednesday 22 October 2008 5:42:40 am

You can not set a object (hash) index in templates.
Your code can be rewritten as:

{def $compteur = 0
       $objets = array()}
									
{foreach $articles as $article}
    {set $objets = $objects|append( $article )}
    {set $compteur = inc( $compteur )}
{/foreach} 
{undef $compteur $objets}

But it doesn't make any sense since $objects is now a identical copy of $articles, and you can do that without the foreach..(ref: {def $objects = $articles})

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Alain Mangana

Wednesday 22 October 2008 7:09:01 am

merci!

http://tikdem.com
/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.