2018-02-25
5267℃
网站的最新发布文章、评论最多的文章、浏览或点击率最高的文章、置顶文章是常调用在首页,侧边栏。
能增强浏览友好度,这几段代码很多站长都喜欢用。
调用最新发布的10篇文章:
{foreach GetList(10) as $newlist}
<li><span>{$newlist.Time('m-d')}</span><a href="{$newlist.Url}" title="{$newlist.Title}">{$newlist.Title}</a></li>
{/foreach}调用点击最多的10篇文章:
{php}
$order = array('log_ViewNums'=>'DESC');
$where = array(array('=','log_Status','0'));
$array = $zbp->GetArticleList(array('*'),$where,$order,array(10),'');
{/php}
{foreach $array as $hotlist}
<li><span>{$hotlist.ViewNums}</span><a href="{$hotlist.Url}" title="{$hotlist.Title}">{$hotlist.Title}</a></li>
{/foreach}调用评论最多的10篇文章:
{php}
$order = array('log_CommNums'=>'DESC');
$where = array(array('=','log_Status','0'));
$array = $zbp->GetArticleList(array('*'),$where,$order,array(10),'');
{/php}
{foreach $array as $hotlist}
<li><span>{$hotlist.CommNums}评论</span> <a href="{$hotlist.Url}" title="{$hotlist.Title}">{$hotlist.Title}</a></li>
{/foreach}调用置顶文章:
{$topArray = GetList(10, null, null, null, null, null, array("only_ontop" => true));}
<ul>
{foreach $topArray as $top}
<li><a href="{$top.Url}" title="{$top.Title}" target="_blank">{$top.Title}</a></li>
{/foreach}
</ul>以上代码都可按自己的要求进行调整修改。