Home > CMS Tutorial > PHPCMS > body text

What should I do if the click volume of phpcms does not move?

藏色散人
Release: 2020-07-21 09:17:27
Original
2070 people have browsed it

The solution to the problem that the click volume of phpcms does not change: First, add the statement "<span id="hits"></span>" to the corresponding position of the template click volume; then introduce the official statistical JS into the template; then find the file "count .php"; finally set the call click volume.

What should I do if the click volume of phpcms does not move?

phpcms article content page calls the code for clicks

Add it to the corresponding position of the clicks in your template :

<span id="hits"></span>
Copy after login

Also note that the official statistical JS should be introduced into the template. The code is:

<script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>
Copy after login

Both of these two are indispensable.

Recommended: "phpcms tutorial"

How to increase the number of random clicks on an article in phpcms v9:

Find the file count.php (website root directory/api)

Find line 50 and find this code $views = $r['views'] 1; 1 here is the default, indicating that every Browse once, the number of clicks increases once, you can modify it to any number you want

Or $views = $r['views'] rand(10,100); Randomly increase any number between 10 and 100 The integer;

1, the home page calls the click volume

{pc:content action="lists" catid="$r[catid]" num="5" order="id DESC" return="info"}
{php $categorys = getcache(&#39;category_content_&#39;.$siteid,&#39;commons&#39;);}
{loop $info $v}
{php $category = $categorys[$v[catid]];}
{php $modelid = $category[&#39;modelid&#39;];}
{php $db = pc_base::load_model(&#39;hits_model&#39;);   $_r = $db->get_one(array(&#39;hitsid&#39;=>&#39;c-&#39;.$modelid.&#39;-&#39;.$v[id])); $views = $_r[views]; }
{php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array(&#39;commentid&#39;=>&#39;content_&#39;.$v[catid].&#39;-&#39;.$v[id].&#39;-&#39;.$modelid));}
·{str_cut($v[&#39;title&#39;],40)} 点击:{$views} 评论:{if $comment_total}{$comment_total}{else}0{/if}
{/loop}
{/pc}
Copy after login

2, the list page calls the click volume

{php $db = pc_base::load_model(‘hits_model’); $_r = $db->get_one(array(‘hitsid’=>’c-’.$modelid.’-’.$r[id])); $views = $_r[views]; }
Copy after login

Click: {$views}

3 , the content page retrieves clicks

<\script type="text/javascript" src="{JS_PATH}jquery.min.js">
<\span id="hits"><\script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"><\/span>
Copy after login

The above is the detailed content of What should I do if the click volume of phpcms does not move?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template