1

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 <td> 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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
James Lin
  • 25,028
  • 36
  • 133
  • 233

2 Answers2

1

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
  • 29,976
  • 9
  • 71
  • 89
1
<td tal:content="php:business[selected_key]"/>

or the "TAL way":

<td tal:content="business/${selected_key}"/>
Kornel
  • 97,764
  • 37
  • 219
  • 309