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 %>)