本文介绍了检测占位符中的最后一个插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法检测放置在占位符中的最后一个(或第一个)插件?
Is there a way to detect the last (or first) plugin that has been placed inside a placeholder?
我想向其中添加class = last我的插件模板,以防最后一个插件。
I want to add a class="last" to my plugin template in case of the last plugin.
推荐答案
尝试一下:
{%if plugin.last%}
这是当前占位符的最后一个插件
{%endif%}
{% if plugin.last %} This is the last plugin for current placeholder{% endif %}
( plugin.first也应该可以)
(plugin.first should also work)
这篇关于检测占位符中的最后一个插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!