Statistics on clicks on static pages _ PHP

Source: Internet
Author: User
The server-side static page generation method in the article publishing system can effectively reduce the burden on the server, especially for large-traffic websites. However, since a static page is generated, what is generated and what is displayed? how can I display the number of times frequently read in articles? After consideration, the following solutions can be used: when a static page is generated, a method that uses the server to generate a static page in the article publishing system can effectively reduce the burden on the server, this is especially effective for large-traffic websites. However, since a static page is generated, what is generated and what is displayed? how can I display the number of times frequently read in articles?


After consideration, the following solutions are available:
When a static page is generated, an article id will be generated and stored in the database. Therefore, when creating an article template, we can write an article on the article id. the article template contains the following statements:


Note:

When you use a template to generate an article, replace "# articleId #" with the newly added Article ID.

The counter. asp file is an asp file for data recording.

<%

''###################

#########

''By Wang Xiangchao

''###################

Dim articleId, sqlStr, hits

ArticleId = int (trim (request. querystring ("articleId ")))

SqlStr = "update articles set hits = hits + 1 where articleId =" & articleId

''Add 1 to the number of clicks in the article

Conn.exe cute (sqlStr)

''Number of reading clicks

Hitsaskconn.exe cute ("select hits from articles where articleId =" & articleId) (0)

%>

''Print the number of clicks

Document. write (<% = hits %>)

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.