Phpcms V9 Implementation Homepage | List Page | Content page Call the number of clicks code

Source: Internet
Author: User

Many friends often ask Phpcms V9 's homepage, list page, content page clicks how to call. Today to share phpcms V9 How to call the click Volume code on the homepage, List page, content page respectively

1,PHPCMS V9 Home Call clicks

  1. {pc:content action="lists" catid="$r [catid]" num="5" order="id DESC" return="info"}
  2. {php $categorys = getcache (' Category_content_ '. $siteid,' Commons ');}
  3. <ul class="list lh24 F14" >
  4. {Loop $info $v}
  5. {php $category = $categorys [$v [CATID]];}
  6. {php $modelid = $category [' ModelID '];}
  7. {php $db = Pc_base::load_model (' Hits_model '); $_r = $db->get_one (Array (' hitsid ' + 'C '. $modelid.' -'. $v [id])); $views = $_r[views]; } 
  8. {php $comment _tag = Pc_base::load_app_class ("Comment_tag", "comment"), $comment _total = $comment _tag-> Count (Array (' commentid ' = 'content_ '. $v [catid].' -'. $v [id]. '-'. $modelid));}
  9. <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>
  10. {/loop}
  11. </ul>
  12. {/PC}

2,PHPCMS v9 List Page clicks

  1. {php $db = Pc_base::load_model (' Hits_model '); $_r = $db->get_one (Array (' hitsid ' = ' C '. $modelid. '-'. $r [id]); $ views = $_r[views]; }
  2. Click: {$views}

3, Phpcms v9 content page to access the volume of clicks

  1. <script type="Text/javascript" src="{js_path}jquery.min.js" ></script>
  2. </span><span id="hits" ><script language="JavaScript" src="{App_path}api.php?op=count &id={$id}&modelid={$modelid} "></script></span>

Original title: Phpcms V9 Implementation Homepage | List Page | Content page Call the number of clicks code

Original address: http://www.abcde.cn/info/show-23-955-1.html

Phpcms V9 Implementation Homepage | List Page | Content page Call the number of clicks code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.