搜 索

phpcms的点击量排行列数据表调用的方法

编辑:QTOOL.NET日期:2019-05-09202

今天,分享一些常用的phpcms列表排行调用方法.
首页获取点击量排行数据的方法
{pc:content action=”lists” catid=”$r[catid]” num=”8″ order=”id DESC”return=”info”}
{php $categorys = getcache(‘category_content_’.$siteid,’commons’);}
<ul>
{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']}” title=”{$v['title']}”{title_style($v[style])}>{str_cut($v['title'],60)}</a>点击:{$views}</li>
{/loop}
</ul>
{/pc}
 
列表页中取得点击排行数据 
{pc:content action=”lists” catid=”$catid” num=”28″ 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>点击:{$views}</li>{/loop}
{$pages}
{/pc} 
 在频道页中获取点击排行
 
{pc:content action=”lists” catid=”$v[catid]” num=”8″ 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]}” {title_style($v[style])}>{$v[title]}</a>点击:{$views}</li>
{/loop}
{/pc}
 以上就是phpcms各类模板中调用点击排行列表的方法.

TAG标签:phpcms
此文章由QTOOL.NET编辑
最新文章

热门标签