Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Daily content order rotation -help appreciated

Maintain order for current user

5:55 pm on Jan 2, 2012 (gmt 0)

New User

5+ Year Member

joined:Jan 2, 2012
posts: 1
votes: 0

Hi Folks
I am struggling to find a solution to what I hope is a fairly simple problem. I have a website for holiday cottages in the UK (that's vacation rentals in US speak!)

The site is very simple in nature, I have about 30 properties, with a page for each one. On the home page there is a short summary of each one, sequentially built-up using php includes ..

<?php include("propertysummary1.php");?>
<?php include("propertysummary2.php");?>

In order to treat each property fairly I would like to change the order that the summairies are displayed, BUT the only code I have found to achieve this uses a random function that is regenerated each time the page loads. Whilst this works, I have had a number of users complain that when they use the back button the homepage is re-ordered and they loose track of which properties they have looked at.

Any ideas how I can change the the content order on say on hourly basis, or preserve an order for individual users sessions so they don't get confused. I still want to display all 30 summaries

[edited by: ergophobe at 6:39 pm (utc) on Jan 3, 2012]
[edit reason] URL removed [/edit]

6:50 pm on Jan 3, 2012 (gmt 0)


WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 25, 2002
votes: 222

A couple of things come to mind. You could use sessions to track a given user and then the question is whether you want to rotate, or shuffle.

Rotating would be easy. Say you have 30 properties. Assign a number between 0 and 29 to each visitor and save it as a session variable.

Then every time the front page loads, you check for the variable and you start listing the properties from that number.

So a user who sees #12 on first visit would always see properties in the order 12, 13, 14... 30, 1, 2, 3... 11.