Current location - Music Encyclopedia - Chinese History - How dedecms Retrieves Users' Reading History
How dedecms Retrieves Users' Reading History
When DEDE generates static, the homepage, list page and article content page all generate HTML. After the document page is refreshed, the number of clicks remains unchanged and the page needs to be regenerated. After analyzing the field labels of the dede content page, the solution is as follows:

JS solution: ({dede:field.click/} This can't be refreshed in real time, so call it with JS. )

How to call the content page: DEDE has a php file dedicated to counting the number of clicks. This document is called count.php. We just need to pass some parameters to it, and we can get the number of clicks on the article. The calling method is also called by JS. You don't need to remember this code, just copy it when you use it.

This is the number of times the article page called the article, and {dede:field name='ID'/} is the article ID.

Call method of list page and home page: You can use [field.id /] in the loop to get list page and home page. Mid is a poster, and generally posts articles with an admin account, so it is generally 1. Because you can't have {} in the list, write down the actual address:

In this way, the hits on the home page and list page can be refreshed in real time like the content page of an article, which is especially suitable for blogs.