国产免费又爽又刺激在线观看,免费一级毛片在线播放放视频,最近日本免费观看高清视频,亚洲无码视频观看

<ruby id="cmmwe"></ruby>

  • <var id="cmmwe"></var>
    <b id="cmmwe"></b>
    <source id="cmmwe"><track id="cmmwe"><ins id="cmmwe"></ins></track></source>

      1. 0712-2888027 189-8648-0214
        微信公眾號(hào)

        孝感風(fēng)信網(wǎng)絡(luò)科技有限公司微信公眾號(hào)

        當(dāng)前位置:主頁(yè) > 技術(shù)支持 > PHPCMS > Phpcms V9 欄目列表調(diào)用文章點(diǎn)擊量及評(píng)論數(shù)量方法

        Phpcms V9 欄目列表調(diào)用文章點(diǎn)擊量及評(píng)論數(shù)量方法

        時(shí)間:2015-11-09來(lái)源:風(fēng)信官網(wǎng) 點(diǎn)擊: 859次

        很多朋友在用Phpcms做站時(shí),具體需要在列表頁(yè)、首頁(yè)調(diào)用文章列表調(diào)用文章的點(diǎn)擊量和評(píng)論排行,那么怎么才能做到在Phpcms v9首頁(yè)、頻道頁(yè)、列表頁(yè)、推薦位等頁(yè)面獲取文章瀏覽量和評(píng)論統(tǒng)計(jì)呢?

        原因起于phpcms官方默認(rèn)的模版沒(méi)有在列表頁(yè)面調(diào)用過(guò)文章點(diǎn)擊量和評(píng)論數(shù)量,而且文章的內(nèi)頁(yè)調(diào)用瀏覽量hit的方法不適用于列表頁(yè)。

        下面是具體的代碼,分享在此,具體在列表頁(yè)調(diào)用文章點(diǎn)擊量的演示在這里:http://www.cmsyou.com/support/。

        一、Phpcms列表頁(yè)面取得文章點(diǎn)擊量及評(píng)論數(shù)量:

        {pc:content action="lists" catid="$catid" num="25" order="id DESC" page="$page" moreinfo="1"} {loop $data $r} {php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r[id])); $views = $_r[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">{date('Y-m-d H:i:s',$r[inputtime])}</span>·<a href="{$r[url]}" target="_blank"{title_style($r[style])}>{$r[title]}</a> 點(diǎn)擊:{$views} 評(píng)論數(shù):{if $comment_total}{$comment_total}{else}0{/if}</li>{/loop} {$pages} {/pc}

        二、Phpcms頻道頁(yè)面取得文章點(diǎn)擊量及評(píng)論數(shù)量:

        {pc:content action="lists" catid="$v[catid]" num="5" order="id DESC"} {loop $data $v} {php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$v[id])); $views = $_r[views]; } {php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$v[catid].'-'.$v[id].'-'.$modelid));} <li><a href="{$v[url]}" target="_blank"{title_style($v[style])}>{$v[title]}</a>點(diǎn)擊: {$views}評(píng)論數(shù):{if $comment_total}{$comment_total}{else}0{/if}</li> {/loop} {/pc}

        三、Phpcms首頁(yè)面取得文章點(diǎn)擊量及評(píng)論數(shù)量:

        {pc:content action="lists" catid="$r[catid]" num="5" order="id DESC" return="info"} {php $categorys = getcache('category_content_'.$siteid,'commons');} <ul class="list lh24 f14"> {loop $info $v} {php $category = $categorys[$v[catid]];} {php $modelid = $category['modelid'];} {php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$v[id])); $views = $_r[views]; } {php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$v[catid].'-'.$v[id].'-'.$modelid));} <li>·<a href="{$v['url']}" target="_blank" title="{$v['title']}"{title_style($v[style])}>{str_cut($v['title'],40)}</a> 點(diǎn)擊:{$views} 評(píng)論:{if $comment_total}{$comment_total}{else}0{/if}</li> {/loop} </ul> {/pc}

        四、Phpcms推薦位取得文章點(diǎn)擊量及評(píng)論數(shù)量:

        {pc:content action="position" posid="2" order="listorder DESC" num="4"} {php $categorys = getcache('category_content_'.$siteid,'commons');} {loop $data $r} {php $category = $categorys[$r[catid]];} {php $modelid = $category['modelid'];} {php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r[id])); $views = $_r[views]; } {php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$r[catid].'-'.$r[id].'-'.$modelid));} <h4 class="blue"><a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title],36,'')}</a> 點(diǎn)擊:{$views} 評(píng)論:{if $comment_total}{$comment_total}{else}0{/if}</h4> <p>{if $n==1}<img src="{thumb($r[thumb],90,60)}" width="90" height="60"/>{/if}{str_cut($r[description],112)}</p> <div class="bk20 hr"><hr /></div> {/loop} {/pc}

        Enjoy it!

        20130228更新:

        要多謝來(lái)自QQ上的網(wǎng)友Huang,他在看了上面的說(shuō)明后,覺(jué)得在統(tǒng)計(jì)頁(yè)面還需要加上統(tǒng)計(jì)的JS,這是對(duì)的。需要在show.html、show_picture.html等模板文件底部加入以下代碼:

        <script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>

        這是官方默認(rèn)模版里邊自帶的,別忘了加上這個(gè)!

        欄目列表
        推薦內(nèi)容
        熱點(diǎn)內(nèi)容
        展開(kāi)