Share » Forums » Setup & design » Print a table

Print a table

Print a table

Monday 11 August 2003 8:07:01 am - 9 replies

Modified on Monday 11 August 2003 8:08:46 am by

Author Message

Alex Jones

Monday 11 August 2003 8:35:55 am

Hans-Henry, I believe all you need to do is place the table tags outside of your let. Something along the lines of:

<table border='1'>
{let children=fetch('content',list,hash(parent_node_id,$node.node_id))}
<tr>
<td>{attribute_view_gui attribute=$node.object.data_map.date}</td>
<td>{attribute_view_gui attribute=$node.object.data_map.team1}</td>
<td>{attribute_view_gui attribute=$node.object.data_map.team2}</td>
</tr>
{/let}
</table>

This will ensure that the rows, and the data cells within them are repeated, but the table tags are only pritned once.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

John van der Boom

Monday 11 August 2003 8:48:45 am

You want to print a different table for every Match-object I guess.

I think this code might work:

{let match_list=fetch(content,list,hash(parent_node_id,$node.node_id,class_filter_type,include,class_filter_array,array(-->match_class_id<--)))}
{section name=match loop=$match_list}
{node_view_gui view=tableview content_node=$match:item}
{/section}
{/let}

Create a tableview_match.tpl:

{default content_version=$node.contentobject_version_object}

<table border='1'>
<tr>
<td>{attribute_view_gui attribute=$content_version.data_map.date}</td>
<td>{attribute_view_gui attribute=$content_version.data_map.team1}</td>
<td>{attribute_view_gui attribute=$content_version.data_map.team2}</td>
</tr>
</table>

{/default}

Do not forget to edit your override.ini(.append) file by entering something like this:

[tableview_match]
Source=node/view/full.tpl
MatchFile=node/view/tableview_match.tpl
Subdir=templates
Match[class]=-->match_class_id<--

edit the -->match_class_id<-- with the id number of the match class.

Monday 11 August 2003 8:53:02 am

Thanks for your reply, but does not print it in one table.
Every instance still gets printed as one table :(

And yes, I've cleared the cache...

John van der Boom

Monday 11 August 2003 8:55:45 am

Are you replying to my code or Alex's one?

Monday 11 August 2003 11:13:10 pm

Thanks for your suggestions but both solutions print a new table for every new instance of the class instead of printing it all in one big table.

Alex Jones

Tuesday 12 August 2003 6:51:55 am

Hrrrrm, did you make sure to clear the cache after testing both methods? Also, are there any other loops or fetch around the code you posted that we don't know about?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Tuesday 12 August 2003 11:10:11 am

Yes, I'm positive. I deleted the cache directory between tests because the cache usually cause problems even though I have disabled cache.
No, there's no loops or fetch that I know about.
This puzzles me...

I'm running eZ 3.1-1 build 2703 with the demo data installed.

It shouldn't be that hard doing such an easy thing, I hope ;)

John van der Boom

Tuesday 12 August 2003 3:01:04 pm

<quote>
You want to print a different table for every match-object I guess.
</quote>

Oops, I thought you wanted to print every instance in a different table.
To accomplish ONE big table with all the instances in it, you should loop only the <tr> ... </tr> part. I put some remarks {* .. *} what every part is doing.

{* Start Code *}

{* start 1 table :) *}
<table border='1'>
{* put all match instance in array match_list *}
{let match_list=fetch(content,list,hash(parent_node_id,$node.node_id,class_filter_type,include,class_filter_array,array(-->match_class_id<--)))}
{* loop over every element in the list *}
{section name=match loop=$match_list}
{* code that should be looped*}
<tr>
<td>{attribute_view_gui attribute=$match:item.contentobject_version_object.data_map.date}</td>
<td>{attribute_view_gui attribute=$match:item.contentobject_version_object.data_map.team1}</td>
<td>{attribute_view_gui attribute=$match:item.contentobject_version_object.data_map.team2}</td>
</tr>
{* end code that should be looped*}
{/section}
{* close let *}
{/let}
{* close table *}
</table>

{* End Code *}

Good luck

Wednesday 13 August 2003 2:09:03 am

Thanks for all your code suggestions, but it still won't work :(
I'll download and do a fresh install from the latest svn and test the code there.

I won't give up that soon because I really like the eZ Publish way of doing things. Looking forward to try the 3.2 release :)

Maybe this table code should have been written in the documentation...

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

36 542 Users on board!

Forums menu