|
A simple random front page image hack
Problem: showing a random picture each time the home page is first loaded.
(Of course this should not effect the loading of images from the browse page.)
I know this has been discussed before but no one seemed to come up with a satisfactory answer to this functionality. Usually people suggested some modification of the site structure with index2.php and random folder image method.
My method is a simple one line modification to the index.php file
line 333 of orginal index.php -
change:
$row = sql_array("SELECT * FROM ".$pixelpost_db_prefix."pixelpost WHERE datetime<='$cdate' ORDER BY datetime DESC limit 0,1");
to:
$row = sql_array("SELECT * FROM ".$pixelpost_db_prefix."pixelpost WHERE datetime<='$cdate' ORDER BY rand() asc limit 0,1");
This will only effect the page when it loaded with no PHP arguments - i.e. only when someone first goes to the site and not when things are accessed from the thumbnails page.
Please note that I think this will only work if you are not logged in as admin. I think modifying that would be simple too.
I'm totally new to this but I have tested this a few times and it seems to work fine - at least for me. Any comments?
Mr.Datsun
|