【问题标题】:Tal condition, defining multiple conditions within same lineTal 条件,在同一行内定义多个条件
【发布时间】:2012-10-11 12:11:56
【问题描述】:

我在下面做的事情是否有替代方法:

...
<div class="abc" tal:condition="this/condition1">
    <div class="abc2" tal:condition="this/condition2">
    ...
    </div>
</div>
...

如:

...
<div class="abc" tal:condition="this/condition1 AND this/condition2">
...
</div>
...

【问题讨论】:

  • 我认为没有办法还是问题不清楚?

标签: php phptal template-tal


【解决方案1】:

这有点傻,但 TALES 中没有逻辑与。

你可以使用php:前缀:

<div tal:condition="php:this.condition1 AND this['condition2']">

但请记住,对于 php:,您需要使用类型相关的语法(. 用于对象,[] 用于数组,因为 / 成为除法)。

【讨论】:

    猜你喜欢
    • 2014-05-12
    • 2020-11-23
    • 1970-01-01
    • 2013-10-06
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 1970-01-01
    • 2017-07-13
    相关资源
    最近更新 更多