【发布时间】:2012-08-29 10:40:51
【问题描述】:
我想在 php 条件下使用 phptal 定义的变量,如下所示:
...
<tal:block define="className php: (photoIndex < 10) ? 'thumbItem thumbColumn1' : ( (photoIndex == 10) ? 'thumbItem thumbColumn2 thumbReset' : 'thumbItem thumbColumn2' )">
<tal:block define="defaultVal photo/isDefault">
<tal:block define="classNameWithIndex php: defaultVal ? '${className} modalMegaPhotoSelect' : '${className}'">
<li tal:attributes="class classNameWithIndex">
...
这里我的输出是“${className} modalMegaPhotoSelect”,我希望它是“thumbItem thumbColumn1 modalMegaPhotoSelect” - 确切的期望是无关紧要的想法是 className 应该被视为一个变量 -
感谢您的宝贵时间。
【问题讨论】:
标签: phptal template-tal