Discuz loop循环次数判断使用教程
如何实现其中的第一条数据或前4条数据,输出一种样式,后面的其他数据,又输出其他的样式呢!

为实现该功能,小编尝试在<!–{loop}–>语句中后方使用了[order=n][/order]或[index=n][/index]语法,但是并没有实现效果。HTML直接输出了order或index文字。
- [order=6]
- <li>
- <a href=”/thread-$index_latest[tid]-1-1.html” class=”topic_img”> <img src=”data/attachment/forum/$tupian” title=”$index_latest[subject]” width=”100px” height=”65px”></a>
- </li>
- [/order]
小编一番折腾,找到了实现方法,小编不易内容回复可见。
通过<!–{if}–>判断变量mindex的值,判断第几个值输出怎么样的样式。<!–{if $mindex==6}–>
<li>
<a href=”/thread-$index_latest[tid]-1-1.html” class=”topic_img”> <img src=”data/attachment/forum/$tupian” title=”$index_latest[subject]” width=”100px” height=”65px”></a>
</li>
<!–{else}–>
<li>
<a href=”/thread-$index_latest[tid]-1-1.html” class=”topic_img”> <img src=”data/attachment/forum/$tupian” title=”$index_latest[subject]” width=”100px” height=”65px”></a>
</li>
<!–{/if}–>[/contentrestriction]