Tag statistics is the number of labels that count,
1, modify the site statistics in the include/lib/cache.php file, add tag statistics cache. It's about 126-147 lines.
The code is as follows |
Copy Code |
Private Function Mc_sta () { $sta _cache = Array (); $lognum = $this->db->num_rows ($this->db->query (select Gid from). Db_prefix. "Blog WHERE type= ' blog ' and hide= ' n '")); $draftnum = $this->db->num_rows ($this->db->query (select Gid from). Db_prefix. "Blog WHERE type= ' blog ' and hide= ' Y")); $comnum = $this->db->num_rows ($this->db->query ("Select CID from"). Db_prefix. "Comment WHERE hide= ' n")); $hidecom = $this->db->num_rows ($this->db->query (select Gid from). Db_prefix. "Comment where hide= ' Y")); $tbnum = $this->db->num_rows ($this->db->query (select Gid from). Db_prefix. "Trackback")); $twnum = $this->db->num_rows ($this->db->query ("SELECT ID from"). Db_prefix. "Twitter")); $tagnum = $this->db->num_rows ($this->db->query ("Select Tid from"). Db_prefix. "tag")//Statistics tab number $sta _cache = Array ( ' Lognum ' => $lognum, ' Draftnum ' => $draftnum, ' Comnum ' => $comnum, ' Comnum_all ' => $comnum + $hidecom, ' Twnum ' => $twnum, ' Hidecomnum ' => $hidecom, ' Tbnum ' => $tbnum, ' Tagnum ' => $tagnum ); |
2, modify the background information page admin/views/index.php, about 21 lines.
<li> have <b><?php echo $sta _cache[' lognum '];? ></b> log, <b><?php echo $sta _cache[' Comnum_all '];? ></b> comments, <b><?php echo $sta _cache[' twnum '];? ></b> broken language, <b><?php echo $sta _cache[' tagnum '];? ></b> tags </li> because the log is changed to an article in Emlog5.1.0beta, the above code can also change the log to an article
Emlog Blog Add site statistics
Quite simply, add the following code to the template section where you want to display it
The code is as follows |
Copy Code |
Number of logs: <?php echo $sta _cache[' lognum '];? > Number of comments: <?php echo $sta _cache[' Comnum_all '];? > Number of broken words: <?php echo $sta _cache[' twnum '];? > Date of construction Station: 2012-11-25 Uptime: <?php Echo Floor ((Time ()-strtotime ("2012-12-05"))/86400);?> |
Li Ming chooses to display the site statistics in the sidebar, adding the following code to the template file (side.php) corresponds to the location. (See effect)
The code is as follows |
Copy Code |
<div style= "border:1px solid #BBD7E6;p adding:5px;margin:10px 0px 10px 0px;background-color: #F7F4ED;" align= "left" > <li> log number: <?php echo $sta _cache[' lognum '];? ></li> <li> Comment Number: <?php echo $sta _cache[' Comnum_all '];? ></li> <li> number of broken words: <?php echo $sta _cache[' twnum '];? ></li> <li> date of construction station:2012-11-25</li> <li> uptime: <?php echo Floor (Time ()-strtotime ("2012-12-05")/86400);?></li> </div> |
This is the whole station display, only on the home page to add the following home to determine the code:
code is as follows |
copy code |
<?php if ("http://". $_server[' http_host '].$_server[' request_uri '] = = Blog_url): //Add your code <?php endif;? |