In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Where is the number of clicks on phpcms v9 articles? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
Which table and which field are the clicks on phpcms v9 articles?
The number of clicks for phpcms v9 articles is in the views field of the hits table.
Detailed explanation:
Get an instance of the number of clicks
{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'= > 'ccombe. Conversation modelid.conversation models.)); $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));} {date ('Y-m-d comment_total >' else} 0 {/ loop} {/ loop} {$pages} {/ pc})
The third line is to get the number of clicks
$db = pc_base::load_model ('hits_model')
Instantiate the object as $db and load the instantiated class hit_model, which is located in the root directory\ phpcms\ model\ hit_model.class.php file
Class hits_model extends model {public $table_name =''; public function _ _ construct () {$this- > db_config = pc_base::load_config ('database'); $this- > db_setting =' default'; $this- > table_name = 'hits'; parent::__construct ();}}
The class file load inherits the model class file and inherits its internal methods, so the following call the get_one () method
$_ r = $db- > get_one (array ('hitsid'= >' cripple. Conversation modelid.roommodelid.conversation color. $r [id]) calls the get_one method in the $db object, which is located in the model class inherited by hits_model. The code is as follows
Final public function get_one ($where =', $data ='*', $order =', $group =') {if (is_array ($where)) $where = $this- > sqls ($where); return $this- > db- > get_one ($data, $this- > table_name, $where, $order, $group);}
The array passed in the method get_one (arr ('hitsid'= >' cmurables. Conversation modelid.colors models. $r [id]) is the values of the fields in the data table v9_hits. The structure of the hits table is as follows
At this time, $_ r is the field views in the data table in the table, that is, the number of clicks on the article, so use $_ r [views] to get the number of clicks!
Note: the data of hitsid field 1-2 indicates that the current model id 2 represents the id of the current article
Thank you for reading! After reading the above, do you have a general idea of the number of clicks on phpcms v9 articles? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.