ezmatrix.tpl override problems

Author Message

Helle Andersen

Friday 16 July 2004 6:58:15 am

I have tried to override the matrix datatype in ezmatrix.tpl.
I want to make alternating blue and tan colored lines using sequense, but I cannot get more than the first tabledata (i.e. the first column) to alternate. No. 2 column remains white
The code runs as follows:
<tr>
{section name=Rows loop=$matrix.rows.sequential sequence=array(tanbg,lightbluebg)}

<td class="{$:sequence}">
{section name=Columns loop=$Rows:item.columns}
{$Rows:Columns:item|wash(xhtml)}   
{delimiter}
</td>

<td class="{$:sequence}">

{/delimiter}

{/section}
</td>

{delimiter}
</tr>

<tr>
{/delimiter}
{/section}

</tr>

Any suggestions ?

Helle Damgaard

Alex Jones

Friday 16 July 2004 9:36:31 am

I think you have mixed a couple of tags that should be separate.

Try something like this:

<tr>
{sequence name=Seq loop=array(tanbg,tanbg,lightbluebg,lightbluebg)}
{section name=Rows loop=$matrix.rows.sequential} 
<td class="{$:sequence}">
{section name=Columns loop=$Rows:item.columns}
{$Rows:Columns:item|wash(xhtml)}&nbsp;&nbsp;&nbsp;
{sequence name=Seq}
{delimiter}
</td>
<td class="{$:sequence}">
{/delimiter}
{/section}
</td>
{delimiter}
</tr>
<tr>
{/delimiter}
{/section}
</tr>

The code may not be perfect, but it should get you closer.

<b>Related Documentation</b>
Complext List with Colors: http://ez.no/ez_publish/documentation/customization/custom_design/examples/common_template_issues/complex_list_with_colours
Sequence: http://ez.no/ez_publish/documentation/development/libraries/ez_template/functions/sequence

Alex
bald_technologist on the IRC channel: #eZpublish
http://www.agrussell.com :: http://www.cuttingedge.com

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

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

Helle Andersen

Thursday 05 August 2004 5:34:26 am

Doesn't work - doesn't even make the first row coloured ...

Hans Melis

Thursday 05 August 2004 12:01:52 pm

The second {$:sequence} should result in a template error/warning. You're using the 'name' attribute of the section command, which means you're using namespaces. The $: is a special reference because it refers to the current namespace (current meaning the most specific namespace where your code is run).

In simple terms, this means that the first {$:sequence} actually means {$Rows:sequence}, which is correct. The second {$:sequence} is in a more specific namespace and is translated into {$Rows:Columns:sequence}, but the Columns namespace doesn't have a sequence variable.

So you should change the second {$:sequence} to {$Rows:sequence}.

hth

--
Hans

Hans
http://blog.hansmelis.be

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