tags:

views:

44

answers:

1

hello, 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 member. 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.

+3  A: 

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 / ... .)

jensgram
ok, it seems to be a solution !
Mamadou
also worth mentioning that you should do some periodic upkeep on your table to make sure you don't keep entries that are too old and irrelevant...
silvo
@silvo Great point. Will incorporate this into my answer.
jensgram