开发者

PHPTAL Nested Repeat

开发者 https://www.devze.com 2022-12-31 00:43 出处:网络
I am having an problem trying to achieve a nested repeat in PHPTAL: <tr开发者_JS百科 tal:repeat=\"business analysis_result\">

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}"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消