phpcms v9中get用法举例,调用点击数。
代码如下:
{pc:get sql="select * from v9_art as g left join v9_art_data as p on p.id=g.id and g.catid=12 order by p.age desc" }
{if $data}
{loop $data $r}
{php $h_md=pc_base::load_model('hits_model');$get_db=$h_md->get_one(array('hitsid'=>"c-".$modelid."-".$r[id]));$views=$get_db[views];}
<li>
<a href="{$r[pic_jj]}" rel="lightbox[example]" title="{$r[hj_url]}" rev="图片演示地址"><img src="{thumb($r[thumb],240,240)}" /></a>
<div class="zt_info">
<h3><a href="{$r[url]}">{$r[title]}</a></h3>
<div>上传时间:{date('Y-m-d H:i:s',$r[inputtime])}</div>
<div>浏览量:{$views}</div>
</div>
<div class="zt_look"><a href="{$r[url]}">查看</a></div>
</li>
{/loop}
{/if}
{/pc}