PHPTAL Nested Repeat
I am having an problem trying to achieve a nested repeat in PHPTAL:
<tr开发者_JS百科 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.
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!
<td tal:content="php:business[selected_key]"/>
or the "TAL way":
<td tal:content="business/${selected_key}"/>
精彩评论