cosmickites Posted February 29, 2008 Share Posted February 29, 2008 I have spent 3 months trying to get an answer to this. We are looking to randominze either our index page or simply the body of the index page. I want the product review to be random when people come visit our page. www.cosmickites.com is this possible? could anyone please please help? Thank you Michael Link to comment https://forums.phpfreaks.com/topic/93718-random-index-page/ Share on other sites More sharing options...
rhodesa Posted February 29, 2008 Share Posted February 29, 2008 I am pretty sure this is built on a third party application right? Which one are you using? Link to comment https://forums.phpfreaks.com/topic/93718-random-index-page/#findComment-480210 Share on other sites More sharing options...
tinker Posted February 29, 2008 Share Posted February 29, 2008 whoa, too many images and stuff for me to wait for it to load... But here's a snippit of a 'rough' I did for someone a while back, it might be a little too much but it is fairly accurate: session_start(); $l=array(0,1,2,3,4,5,0,1,2,3,0,1,0,1,0,1,0,1,0,0); if(isset($_SESSION['redirector'])) { $l = $_SESSION['redirector']; } if(count($l) == 0) { $l=array(0,1,2,3,4,5,0,1,2,3,0,1,0,1,0,1,0,1,0,0); } function get_redirect() { global $l; $url[0] = "http://www.siteone.com"; $url[1] = "http://www.sitetwo.com"; $url[2] = "http://www.sitethree.com"; $url[3] = "http://www.sitefour.net"; $url[4] = "http://www.sitefive.com"; $url[5] = "http://www.sitesix.com"; srand ((double)microtime()*1000000); $n = rand(0, count($l)-1); $ll = array_keys($l); $nn = $ll[$n]; $sret = $url[$l[$nn]]; unset($l[$nn]); $_SESSION['redirector'] = $l; return $sret; } print get_redirect(); Link to comment https://forums.phpfreaks.com/topic/93718-random-index-page/#findComment-480215 Share on other sites More sharing options...
Northern Flame Posted March 1, 2008 Share Posted March 1, 2008 well if your reviews are in a mysql table all you have to do is add this to the query that selects them: SELECT * FROM table_name ORDER BY RAND() LIMIT 10 (you can change the limit to however many reviews you want shown) Link to comment https://forums.phpfreaks.com/topic/93718-random-index-page/#findComment-481129 Share on other sites More sharing options...
cosmickites Posted March 2, 2008 Author Share Posted March 2, 2008 hey Tinker, does this go after the head in my index page? also, any idea what I should do to speed up the loading of the page? rhodesa. i used dreamweaver to make the site Link to comment https://forums.phpfreaks.com/topic/93718-random-index-page/#findComment-481969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.