Last visited pages in site
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 / ... .)
精彩评论