【发布时间】:2009-11-03 18:08:38
【问题描述】:
有没有人写过一个块模板标签,用一些分隔符连接任意 html sn-ps,其中省略了空项?
可用于呈现类似菜单的列表,其中显示的项目是在运行时确定的,而要连接的项目需要精细的标记。
谢谢。
例如:
{% joinitems using ' | ' %}
{% if show_a %}
<p>Some HTML here</p>
{% endif %}
{% separator %}
{% if show_b %}
<p>And some here</p>
{% endif %}
{% endjoinitems %}
【问题讨论】: