【发布时间】:2020-07-18 03:51:08
【问题描述】:
<tal:block tal:repeat="image project/images">
<div
tal:define="onlyone python:if repeat.image.length==1: return 'onlyone'"
tal:attributes="class python:'image-{}'.format(repeat.image.number)">
<img
tal:define="img image/getObject"
tal:replace="structure img/@@images/image/custom_1280"
/>
</div>
</tal:block>
我已经有一个基于循环索引打印“image-N”的类,但是如果长度为“1”,我该如何添加另一个类? 文档不清楚https://zope.readthedocs.io/en/latest/zopebook/AppendixC.html#tales-python-expressions,它说可以使用任何有效的python表达式,但语法对我来说总是错误的。
【问题讨论】:
-
您应该在我们的论坛community.plone.org 中提出此类问题。请参阅plone.org/support,了解如何最好地获得有关 Plone 的帮助