Program | show in the article publishing system using server-side to generate static pages can effectively reduce the burden on the server, especially for large traffic site is very effective. 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
<%
'###################
' ##### #开始 #########
Dim articleid,sqlstr,hits
Articleid=int (Trim (Request.QueryString ("ArticleID"))
sqlstr= "Update articles set hits=hits+1 where articleid=" & ArticleID
' Click on a number plus 1 for the article
Conn.execute (SQLSTR)
' Read the number of clicks on the article
Hits=conn.execute ("Select hits from articles where articleid=" & ArticleID) (0)
%>
' Print out the number of clicks on the article
document.write (<%=hits%>)