效果展示:

phpcms v9 列表页面取得文章点击量及评论数量_点击数

源代码:

  1. {pc:content action="lists" catid="$catid" num="10" moreinfo="1" order="id DESC" page="$page"
  2.         <!-- <div class='videoImg'><a href="{$r[url]}" target='_blank'><img  rel='nofollow' src="{$r[thumb]}" border='0' class='preimg120' alt="{$r[title]}" name='preimg' /></a></div> --> 
  3.         <ul class="list lh24 f14"
  4.         {loop $data $r
  5.         {php $db = pc_base::load_model('hits_model');   $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r[id])); $views = $_r[views]; } 
  6.         {php $comment_tag = pc_base::load_app_class("comment_tag""comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$catid.'-'.$r[id].'-'.$modelid));} 
  7.         <li><span class="rt">阅读:{$views} | 评论:{if $comment_total}{$comment_total}    {else}0{/if}</span>[{date('Y-m-d',$r[inputtime])}]<a href="{$r[url]}" target="_blank"{title_style($r[style])}>{$r[title]}</a></li> 
  8.         {if $n%5 ==0}<li class="bk20 hr"></li>{/if}  
  9.         {/loop} 
  10.         </ul> 
  11. {/pc}