Implement click Count in static page

Source: Internet
Author: User
In the article publish the system to use the server side to generate the static page the method can reduce the server the burden effectively, especially is very effective to the big traffic website. But since the generated is static page, what is the generation, what is the display, for the article common article is read how many times show it?
After consideration, the following schemes can be used to resolve:
When generating a static page, the ID of an article is generated and stored in the database, so we can make a fuss about the ID of the article when we create the template for the article, and the article template contains the following statements:
<script src= "counter.asp?articleid=<%= #articleId #%>" ></script >
Description
When you generate an article from a template, match the "#articleId #" to the pattern, replacing the ID number of the newly added article.
 
counter.asp file is an ASP file for implementing a Count
<%
''###################
"' ##### #开始 #########
' By Wang Xiangxu
''###################
Dim articleid,sqlstr,hits
Articleid=int (Trim (Request.QueryString ("ArticleID"))
sqlstr= "Update articles set hits=hits+1 where articleid=" & ArticleID
"To the article click on the number plus 1
Conn.execute (SQLSTR)
"Read the article click Number
Hits=conn.execute ("Select hits from articles where articleid=" & ArticleID) (0)
%>
"Print out the number of clicks on the article
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.