<p>I'm trying out PHPTAL and I want to render a table with zebra stripes. I'm looping through a simple php assoc array ($_SERVER).</p>

<p>Note that I don't want to use jQuery or anything like that, I'm trying to learn PHPTAL usage!</p>

<p>Currently I have it working like this (too verbose for my liking):</p>

<pre><code>&lt;tr tal:repeat="item server"&gt;
  &lt;td tal:condition="repeat/item/odd" tal:content="repeat/item/key" class="odd"&gt;item key&lt;/td&gt;
  &lt;td tal:condition="repeat/item/even" tal:content="repeat/item/key" class="even"&gt;item key&lt;/td&gt;
  &lt;td tal:condition="repeat/item/odd" tal:content="item" class="odd"&gt;item value&lt;/td&gt;
  &lt;td tal:condition="repeat/item/even" tal:content="item" class="even"&gt;item value&lt;/td&gt;
&lt;/tr&gt;
</code></pre>

<p>Basically I want some kind of conditional assignment on the fly, but I'm unsure of the syntax.</p>

Well, it seems like I have my own answer, though I still think this is rather ugly:
```
```
<tr tal:repeat="item server">
  <td tal:content="repeat/item/key" tal:attributes="class php: repeat.item.odd ? 'odd' : 'even'">item key</td>
  <td tal:content="item" tal:attributes="class php: repeat.item.odd ? 'odd' : 'even'">item value</td>
</tr>
```
```
Anyone got anything more graceful looking for PHPTAL?