A-A+
phpcms v9 列表页面取得文章点击量及评论数量
{pc:content action="lists" catid="$catid" num="10" moreinfo="1" order="id DESC" page="$page"} <!-- <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> --> <ul class="list lh24 f14"> {loop $data $r} {php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r[id])); $views = $_r213 views; } {php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$catid.'-'.$r[id].'-'.$modelid));} <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> {if $n%5 ==0}<li class="bk20 hr"></li>{/if} {/loop} </ul> {/pc}