站点介绍
我们知道如果能够在zblog文章调用文相关文章,无疑能够提升网站的吸引力,增加文章的访问量,要想实现调用的功能,我们可以通过官方提供的一组代码进行操作,代码如下:
{$aid=$article.ID}{$tagid=$article.Tags}{$cid=$article.Category.ID}{php} $tagrd=array_rand($tagid); if( sizeof($tagid)>0 && ($tagid[$tagrd]->Count)>1){ $tagi='%{'.$tagrd.'}%'; $where = array(array('=','log_Status','0'),array('like','log_Tag',$tagi),array('<>','log_ID',$aid)); }else{ $where = array(array('=','log_Status','0'),array('=','log_CateID',$cid),array('<>','log_ID',$aid)); } $array = $zbp->GetArticleList(array('*'),$where,array('rand()'=>' '),array(6),''); foreach ($array as $related) { if(($related->ID)!=$aid){ $str .= "<li><span class=\"time\">{$related->Time('m-d')}</span><span class=\"title\"><i class=\"icon-doc-text\"></i><a href=\"{$related->Url}\" title=\"{$related->Title}\">{$related->Title}</a></span><small class=\"pcomm\"><i class=\"icon-comment-1\"></i> <a href=\"{$related->Url}#comments\" rel=\"nofollow\" title=\"《{$related->Title}》上的评论\">{$related->CommNums}</a></small></li>"; } }{/php}{$str}然后我们需要将以上代码添加到post-single.php文件相关文章的对应位置即可。