Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #11  
Old 01-22-2008, 06:55 AM
Marx Offline
forum loafer
 
Join Date: Aug 2006
Location: Belgium somewhere near Brugge
Posts: 7
Dang.. must get more sleep ;-)
Thanks, I've got it. It works.
Reply With Quote
  #12  
Old 03-02-2008, 08:36 PM
fredxeric's Avatar
fredxeric Offline
pixelpost guru
 
Join Date: Sep 2006
Location: Montréal, Québec, Canada
Posts: 407
Send a message via AIM to fredxeric Send a message via MSN to fredxeric
oups didn't read the complete tread I found the answer to my question that was with line for version 1.7.1... sorry

Last edited by fredxeric; 03-02-2008 at 09:10 PM.
Reply With Quote
  #13  
Old 03-02-2008, 11:16 PM
kevincrafts's Avatar
kevincrafts Offline
pixelpost guru
 
Join Date: Jul 2007
Location: Colorado
Posts: 434
Lightbulb

Here's a random front page image that does not require any hacking...

http://www.pixelpost.org/extend/addo...nt-page-image/
__________________
Kevin | Light & Dark Photoblog

Reply With Quote
  #14  
Old 03-28-2009, 08:05 AM
AlanC Offline
forum loafer
 
Join Date: Mar 2008
Posts: 5
Kevin - I think I've been able to misinterpret your simply instruction to put <RANDOMFRONT> into the first line of image_template.html. Do you mean the literal first line:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

or some other? I get either a 404 or no randomization depending on where I insert it. The 404 clears when I turn off Randomization in admin panel. Will you be kind enough to reply with a line that has the tag correctly inserted?

Thanks!

Alan
__________________
Reply With Quote
  #15  
Old 03-28-2009, 07:19 PM
AlanC Offline
forum loafer
 
Join Date: Mar 2008
Posts: 5
I'm following up on my last post with some lessons learned en route to getting random images on the opening page to work correctly. I found the original 08-27-2007 post by iaredatsun that had a 1-line index.php hack that worked perfectly for me in 1.7.1. The full text is below to save you looking around, but I modified line 428 instead of 333. To find the line, I searched index.php for the string

$row = sql_array("SELECT * FROM

and replaced the first occurrence of the entire row containing that partial statement with

$row = sql_array("SELECT * FROM ".$pixelpost_db_prefix."pixelpost WHERE datetime<='$cdate' ORDER BY rand() asc limit 0,1");

FWIW, I use a customized badarrow template, Ajax Categories Manager, External App Upload (for LR) and ImageCycle. All coexist happily with this hack. I saw it in the thread and got the same results in that randomization does not work while I'm logged in as admin, but starts immediately after I log out. I'm happy with that and am not going to look for the line that is called when I'm logged in.

Thanks iaredatsun!

****Original Post Text***

Old 08-27-2007, 05:20 AM
iaredatsun Offline
forum loafer

Join Date: Aug 2007
Posts: 6
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
__________________
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 10:25 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs