phpcms实现在首页列表页频道页调用评论数代码分享

phpcms实现在首页列表页频道页调用评论数代码分享,第1张

概述废话不多说,直接上代码 一、Phpcms列表页面取得文章点击量及评论数量: {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_o

废话不多说,直接上代码
一、PHPCMS列表页面取得文章点击量及评论数量:


{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 >{date('Y-m-d H:i:s',$r[inputtime])}</span>&mIDdot;<a href="{$r[url}" target="_blank"{Title_style($r[style])}>{$r[Title]}</a> 点击:{$vIEws} 评论数:{if $comment_total}{$comment_total} {else}0{/if}</li>
{/loop}
{$pages}
{/pc}

二、PHPCMS频道页面取得文章点击量及评论数量:


{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>点击:{$vIEws}评论数:{if $comment_total}{$comment_total}{else}0{/if}</li>
{/loop}
{/pc}

三、PHPCMS首页面取得文章点击量及评论数量:


{pc:content action="Lists" catID="$r[catID]" num="5" 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>&mIDdot;<a href="{$v['url']}" target="_blank" title="{$v['Title']}"{Title_style($v[style])}>{str_cut($v['Title'],40)}</a> 点击:{$vIEws} 评论:{if $comment_total}{$comment_total}{else}0{/if}</li>
{/loop}
</ul>
{/pc}

四、PHPCMS推荐位取得文章点击量及评论数量:


{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 ><a href="{$r[url]}" title="{$r[Title]}">{str_cut($r[Title],36,'')}</a> 点击:{$vIEws} 评论:{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 ><hr /></div>
{/loop}
{/pc}

总结

以上是内存溢出为你收集整理的phpcms实现在首页列表页频道页调用评论数代码分享全部内容,希望文章能够帮你解决phpcms实现在首页列表页频道页调用评论数代码分享所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/998461.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存