在博主发表博文时浏览者的评论,可以让用户增加对博文的了解程度,更能让用户感受到博主的专业程度。可谓一篇文章的必需之物。尤其是在这个浮躁的网络环境中,看到一篇长长的密密麻麻的文字,你能耐心看下去吗?
很多人应该都是做不到的吧,那我们考什么来吸引用户的粘度呢?
就是评论!
回帖率可以反映读者对博客内容的兴趣和共鸣, 有影响力的博客总是失掉共鸣, 所以有很多留言, 但一些没有意义甚至不健康的回帖关于博客的评价作用不大。 如果评论或回帖数量不多, 但质量高, 或许作者的影响力很大时也应作为评价参考。
以下是K9中常见的几种tag的用法,注意各用法的条件where。
标签说明:
<img src="{DIR}user/avatar.php?userid={$rs[userid]}&size=m" alt="{$rs[username]}"/>:标签为调用用户头像;
{$rs[username]}:标签为调用用户名
{$rs[ip] code='ip'}:标签为用户未登陆时所发表的评论,因为K9支持游客评论模式;
{$rs[content] code='nl2br'}:标签为调用用户评论的内容。
调用评论内容的最新评论:
{@res.join table1='%s_content_comment' field1='id,date,ip,content' table2='%s_user' field2='userid,username'on='t1.cid=t1.cid and t1.userid=t2.userid' where="t1.status=1" order='t1.cid desc' number='8' } {#foreach($res as $rs)} <ul> {#if(!empty($rs['userid']))} <li><a href="#"><img src="{DIR}user/avatar.php?userid={$rs[userid]}&size=m" alt="{$rs[username]}"/></a> {#endif} {#if(!empty($rs['userid']))} <a href="#">{$rs[username]}</a><span>说:</span> {#else} <li><a href="#"><img src="{DIR}user/avatar.php?userid={$rs[userid]}&size=m" alt="{$rs[username]}"/></a> <a href="#">{$rs[ip] code='ip'}</a><span>说:</span> {#endif} <p>{$rs[content] code='nl2br'}</p> </li> </ul> {#endforeach}调用文章标题的最新评论:
{@res.join table1='%s_content_comment' field1='id,date,ip,content' table2='%s_user'field2='userid,username'table3='%s_content' field3='title,url' on='t1.cid=t1.cid and t1.userid=t2.userid and t3.id=t1.id'where="t1.status=1"order='t1.cid desc' number='5' } {#foreach($res as $rs)} {#if(!empty($rs['userid']))} <li>{$rs[username]}: {#else}<li>{$rs[ip] code='ip'}: {#endif} <a href="{DIR}{$rs[url]}" title="{$rs[title]}">{$rs[title]}</a> </li> {#endforeach}调用评论最多的文章:
{@res.join table1='%s_content_comment_hit' table2='%s_content' field='sum(t1.hit) hit' field2='title,url,comment' on='id'where='t2.status=1' group='t1.id' order='hit desc' number='5'} {#foreach($res as $rs)} <li><a href="{DIR}{$rs[url]}" title="{$rs[title] code='quote'}">{$rs[title]}</a><span>[{$rs['hit']}条评论]</span></li> {#endforeach}调用文章内容页评论:
{@res.join table1='%s_content_comment' field1='id' table2='%s_user' field2='userid,username'table3='%s_content_comment' field3='date,ip,content' on='t1.cid=t3.cid and t1.userid=t2.userid' where="t1.id={$info['id']} and t1.status=1" order='t1.cid desc' number='8' } {#foreach($res as $rs)} <div class="comment-author"> <img class="avatar" src="{DIR}user/avatar.php?userid={$rs[userid]}&size=m" alt="{$rs[username]}" width="32" height="32"/> <cite class="fn"> {#if(!empty($rs['userid']))} {$rs[username]} {#else} {#rs[ip] code='ip'} {#endif} </cite> </div> <div class="comment-meta"> {$rs[date] date='Y-m-d H:i'} </div> <p>{$rs[content] code='nl2br'}</p> {#endforeach}评论列表页:
{@res.select_join table1='%s_content_comment' field1='id' table2='%s_user'field2='userid,username'table3='%s_content_comment' field3='date,ip,content' on='t1.cid=t3.cid and t1.userid=t2.userid'where="t1.id={$info['id']} and t1.status=1" order='t1.cid desc' number='20' url="?content-comment&id={$id}&pid=PID"} {#foreach($res as $rs)} {#if(!empty($rs['userid']))} <img src="{DIR}user/avatar.php?userid={$rs[userid]}&size=m" alt="{$rs[username]}"/> {#endif} <strong> {#if(!empty($rs['userid']))} {$rs[username]} {#else} {#rs[ip] code='ip'} {#endif} </strong> <em>{$rs[date] date='Y-m-d H:i'}</em> <br/> <span>{$rs[content] code='nl2br'}</span> {#endforeach}
转载请注明出处:唯众网络