相关文章并且随机,不适合数据多的站
<h2 class="index-h2"> 相关文章 </h2> {foreach GetList(6,1,null,null,null,null,array('is_related'=>$article.ID,'has_subcate' => true,'order_custom' => array('rand()'=>' '))) as $related} <div class="excerpt"> <h3><a href="{$related->Url}" title="{$related->Title}">{$related->Title}</a></h3> <p>{php}$artreldes = preg_replace('/[\r\n\s]+/', ' ', trim(SubStrUTF8(TransferHTML($related->Content,'[nohtml]'),180)).'...');{/php}{$artreldes}</p> </div> {/foreach}>
相关文章 热门,测试感觉数据多也不快
<h2 class="index-h2"> 相关文章 </h2> {foreach GetList(6,1,null,null,null,null,array('is_related'=>$article.ID, 'order_custom' => array('log_ViewNums' => 'DESC'))) as $related} <div class="excerpt"> <h3><a href="{$related->Url}" title="{$related->Title}">{$related->Title}</a></h3> <p>{php}$artreldes = preg_replace('/[\r\n\s]+/', ' ', trim(SubStrUTF8(TransferHTML($related->Content,'[nohtml]'),180)).'...');{/php}{$artreldes}</p> </div> {/foreach}
随机,数据多感觉效率也不高 函数
<div class="widget_artlist"><h3 class="widget_tit">随便看看</h3><ul> {foreach default_rand_article(24) as $related} <li><a href="{$related.Url}" title="{$related.Title}">{$related.Title}</a></li> {/foreach} </ul> </div>
请登录之后再进行评论