开发者

Last visited pages in site

开发者 https://www.devze.com 2023-01-16 18:58 出处:网络
I have one script where am trying to display in a website block The LATEST ARTICLES VISITED BY THE CURRENT USER.

I have one script where am trying to display in a website block The LATEST ARTICLES VISITED BY THE CURRENT USER. The user can be anonymous or a mem开发者_如何学Pythonber. The articles are in table like [ id_art, intro, text]

So when the visitor X visit a page, i would like to put in the bloc the visited page.


Create a table on the form:

id, tstamp, art_id (key=[id, tstamp, art_id], index=[id, tstamp])

Whenever a user requests an article, add a row with article ID and timestamp. For the ID you can use the user ID for members or an auto-generated ID (persisted in a (session) cookie).

The list is then generated by extracting the latest N records in the table based on the (user/auto) id. (I.e., the actual list is generated by extracting N article titles and links based on a join on the IDs in the two tables.)

Credit goes to silvo for the following point (see comments):

... you should do some periodic upkeep on your table to make sure you don't keep entries that are too old and irrelevant

(Note: This is a generic solution. Nothing specific for Joomla / technology X / ... .)

0

精彩评论

暂无评论...
验证码 换一张
取 消