Hello everyone, a little busy today, see a lot of friends often ask Phpcms v9 home, List page, content page call Click How to make, plan to take time to sum up the code, so that we can use later, as follows:
1, Home Call Click Volume
{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> click: {$views} comment: {if $comment _total}{$comment _total}{else}0{/if}</li> {/loop} </ul > {/PC}
2, List page, click Volume
{php $db = Pc_base::load_model (' Hits_model '); $_r = $db->get_one (Array (' hitsid ' = ' C '. $modelid. '-'. $r [id]); $ views = $_r[views]; } click: {$views}
3, content page fetch clicks
<script type= "Text/javascript" src= "{js_path}jquery.min.js" ></script> </span><span id= "hits" ><script language= "JavaScript" src= "{app_path}api.php?op=count&id={$id}&modelid={$modelid}" > </script></span>
Suggest that you develop a good habit, the collection of useful code, not only in order to be able to improve the efficiency of the Imitation station, thank you again for The imitation of the network support.
Article link: http://www.upxinyuan.com/wangzhanjiaocheng/302_1.html do not reprint the consequences of self-esteem