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.

eZ debug

Timing: Jan 18 2025 16:14:53
Script start
Timing: Jan 18 2025 16:14:53
Module start 'layout'
Timing: Jan 18 2025 16:14:53
Module start 'content'
Timing: Jan 18 2025 16:14:54
Module end 'content'
Timing: Jan 18 2025 16:14:54
Script end

Main resources:

Total runtime1.0062 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0037 588.9453152.6094
Module start 'layout' 0.00370.0030 741.554739.4141
Module start 'content' 0.00660.9980 780.9688548.1641
Module end 'content' 1.00470.0014 1,329.132812.1875
Script end 1.0061  1,341.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2945160.0002
Check MTime0.00130.1280160.0001
Mysql Total
Database connection0.00050.047410.0005
Mysqli_queries0.954794.8839570.0167
Looping result0.00050.0493550.0000
Template Total0.978797.320.4893
Template load0.00200.201520.0010
Template processing0.976697.063320.4883
Template load and register function0.00010.011210.0001
states
state_id_array0.00150.146010.0015
state_identifier_array0.00170.165920.0008
Override
Cache load0.00170.1713310.0001
Sytem overhead
Fetch class attribute can translate value0.00090.094120.0005
Fetch class attribute name0.00100.096450.0002
XML
Image XML parsing0.00170.171920.0009
class_abstraction
Instantiating content class attribute0.00000.003060.0000
General
dbfile0.00130.1260230.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs