homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Daily content order rotation -help appreciated
Maintain order for current user

Msg#: 4403251 posted 5:55 pm on Jan 2, 2012 (gmt 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]



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

Msg#: 4403251 posted 6:50 pm on Jan 3, 2012 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved