DEDECMS 列表页面ul li 循环调用

时间就是生命。时光不会倒流,珍惜此刻,奋斗未来吧。记住你无畏青春的样貌,你未必出类拔萃,但必须与众不一样。

之前仿站,在列表页的时候,经常有个问题在困扰,遇到这样的情况应该如何去做调用呢?代码如下:

<div>
<ul>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第一篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第二篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第三篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第四篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第五篇</a></li>
</ul>
<ul>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第六篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第七篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第八篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第九篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第十篇</a></li>
</ul>
<ul>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第十一篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第十二篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第十三篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第十四篇</a></li>
<li><span>2011-08-23 23:10</span><a rel="nofollow noopener noreferrer" href="#">测试文章第十五篇</a></li>
</ul>
</div>

终于找到以下代码,将此问题搞定:

<ul>
{dede:list pagesize='24' orderby='pubdate'}
                    [field:global runphp='yes' name=autoindex]
                    $b="</ul><ul>";
                    $a="";
                    if(@me%6==0) @me=$b;
                    else @me=$a;
                    [/field:global]
<li><span>[field:pubdate function="GetDateTimeMK(@me)"/]</span><a rel="nofollow noopener noreferrer" href="[field:arcurl/]">[field:title/]</a></li>{/dede:list}
</ul>

本文DEDECMS 列表页面ul li 循环调用到此结束。要铭记在心:每天都是最美好的日子。小编再次感谢大家对我们的支持!

标签: DEDECMS ul