要展现20条不一样的文章,你可以修改代码中的foreach循环,将循环次数设置为20,并且添加一个计数器变量,以确保每次循环都获取不同的文章。

以下是修改后的代码示例:

<ul class="list-pic">
{set $count = 0}
{foreach GetList(20,null,null,null,null,null,array('is_related'=>$article.ID)) as $related}
    {if $count < 20}
        <li class="wendang-morelist-item">
            <strong><a href="{$related.Url}">{$related.Title}</a></strong>
            <p><div class="intros">{wendang_intro($related,100,"...")}</div></p>
        </li>
        {set $count = $count + 1}
    {/if}
{/foreach}
</ul>

这样,循环将会执行20次,并且在每次循环中,只有计数器变量小于20时才会获取文章信息并展示。这样就能确保展示20条不一样的文章

ul class=list-picforeach GetList16nullnullnullnullnullarrayis_related=$articleID as $relatedli class=wendang-morelist-itemstronga href=$relatedUrl$relatedTitleastrongpdiv class=introswendang_intro$rel

原文地址: http://www.cveoy.top/t/topic/iTfR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录