tags:

views:

99

answers:

2

Hello guys,

I am having an problem trying to achieve a nested repeat in PHPTAL:

    <tr tal:repeat="business analysis_result">
 <td>${business/trading_name}</td>
 <tal:block tal:repeat="selected_key selected_keys">
  <td>HOW??????</td>                               <---problem
 </tal:block>
</tr>

basically I want to have the of inner repeat to get the value of $business[$selected_key], I have looked at the phptal manual which doesn't really give you a demo on how to do this...

cheers guys!

James

A: 

Try

<tr tal:repeat="business analysis_result">
    <td>${business/trading_name}</td>
    <tal:block tal:repeat="selected_key business/selected_keys">
    <td tal:content="selected_key"/>
    </tal:block>
</tr>

Imagine if you were using php instead of some new language you have to learn! Imagine how easy it would be!

Galen
sorry this doesn't work, because the selected_key holds the associative key of the business array
James Lin
A: 
<td tal:content="php:business[selected_key]"/>

or the "TAL way":

<td tal:content="business/${selected_key}"/>
porneL