一般在网站侧栏,我们希望有调出最新的用户评论,如果我们主题没有可以手工添加这段调出代码。如果有的主题自带的,那我们就没有必要再添加。

{php}$comments = $zbp->GetCommentList('*', array(array('=', 'comm_IsChecking', 0),array('<>', 'comm_AuthorID','1')), array('comm_PostTime' => 'DESC'), 8, null);{/php}{foreach $comments as $comment}{php}$clpl = preg_replace('/[\r\n\s]+/', '', trim(SubStrUTF8(TransferHTML($comment->Content,'[nohtml]'),80)).'');{/php}<li>    <p>        <a href="{$comment.Post.Url}#cmt{$comment.ID}" target="_blank">{$clpl}</a>        <small><span><img  alt="{$comment.Author.Name}"  src="{$comment.Author.Avatar}" ></span>{$comment.Author.Alias} 评论于:<a href="{$comment.Post.Url}#cmt{$comment.ID}" title="{$comment.Post.Title}" target="_blank">{$comment.Post.Title}</a></small>     </p></li>{/foreach}

默认是添加8条评论,且排除1用户的评论内容,一般1是管理员。我们可以根据实际需要调整上面代码参数。


转载于:https://www.lep.me/4.html