Zblog调用热门排行自定义天数文章

  这个代码是需要写到include.php这个模板文件里,我们直接上代码吧

  代码:

[lv]

//热门排行 function qb97_hot($day){ global $zbp; $hot = ''; $nowtime = time(); $settime = $day*24*60*60; $gettime = $nowtime-$settime; $array = $zbp->GetArticleList(array('*'),array(array('=','log_Status','0'),array('>','log_PostTime',$gettime)),array('log_ViewNums'=>'DESC'),array(14),''); foreach ($array as $article) { $hot .= '<li><a href="'.$article->Url.'" title="'.$article->Title.'" target="_blank">'.$article->Title.'</a></li>'; } $hot .= ''; return $hot; }

[/lv]

  把上面的代码复制进入include.php之后,在你需要的模板文件中插入下面代码

{qb97_hot('7')}

  qb97_hot('7')中的7代表一周内热门文章排行,当然可以在模板中自定义写入即可