I’m sure many of you have visited amazon.com. When you do, amazon creates a list of browsed menu items at the very bottom of the home page.
I am currently doing a project that applies personalisation and customisation and wanted to implement something similar. My prototype is based on an institution, so I want to display a list of, say, the last 5 viewed programmes or courses on the home page. I am using PHP and so far i have thought of using $_SERVER["HTTP_REFERER"], but this returns only the last URL, which is not what I want. Does anyone have any suggestions to help me with this?
Thanks.
What you could do is something like what follows:
each time the user visits one of the pages you want recorded, append that URL to the session variable
if you want to limit the array’s length, use a function in which you check the length and optionally remove the oldest element as you append a new one (this is in principle a FIFO queue).
This assumes that you want to show the last programmes / courses that the user visited. If you want to show the last programmes visited by all visitors to the site, you’ll have to do something similar to the above but using something to keep track of global state, like a database or a file.