Forums / Setup & design / List child objects in a table
Benjamin Selmer
Thursday 06 October 2005 1:42:48 am
I have made a overide template for node/view/full/folder
I want to list the child objects of a spesific node in a table with two columns.
I tried witht the following code:
{def $column=1} <table class="class-butikker"> {section var=child loop=$list_items sequence=array(bglight,bgdark)} {if eq($column, 1)} {set $column=2} <tr> <td> {node_view_gui view=line content_node=$child} </td> {else} {set $column=1} <td> {node_view_gui view=line content_node=$child} </td> </tr> {/if} {/section} </table>
It seems that eZ Publish automatically closes the tags. The result is that i get one column and not two.
Does anyone know of a clever way to solve this?
Roy Bøhmer
Thursday 06 October 2005 2:45:45 am
I think you have a bug in your if-statement. It forces eZ to only input one td-tag for each tr. Not sure what you need the $column for. Try:
{def $column=1} <table class="class-butikker"> {section var=child loop=$list_items sequence=array(bglight,bgdark)} <tr> {set $column=1} <td> {node_view_gui view=line content_node=$child} </td> {set $column=2} <td> {node_view_gui view=line content_node=$child} </td> </tr> {/section} </table>
This will result in two identical columns.
Thursday 06 October 2005 3:27:23 am
Two identical columns is of no use.
This is how i wanted it to work:
if column variable equals 1: -insert tr start tag -insert td-set column variable=2
if column variable equals 2: -insert td -insert tr end tag-set column variable=1
This should result in a table with two columns, but eZ automatically closes the tr after the first td.
I guess i coluld get a table-like result by floating the div's with css. But that does not work properly with all browsers.
Thursday 06 October 2005 6:19:53 am
Sorry, I read it too quick.
I've never heard of ez automatic closing tags. Actually your code looks ok.
Are you sure templates/node/view/line.tpl (or an override) doesn't contain any <tr></tr>?
Thats all I can think of right now, but I admit I don't think that's the problem :-)Could you post the relevant html-output?
Roy