当前位置:首页 > 未命名

记录和分享Zblog PHP文章调用相关文章的官方代码

8976988823个月前 (01-10)未命名5

我们知道如果能够在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文件相关文章的对应位置即可。

扫描二维码推送至手机访问。

版权声明:本文由米表程序发布,如需转载请注明出处。

本文链接:https://www.9909999.xyz/post/368.html

分享给朋友: