PDA

View Full Version : Random pics from a specific category


dkmulford
June 3rd, 2005, 11:10 AM
A while back on photopostdev there was some discussion about trying to do a PAL that would select random pictures from a specific category (versus from all categories). See the link below.

Has anyone done this mod yet?

Thanks,
Darren

http://www.photopostdev.com/showthread.php?p=5525#post5525

Chuck S
June 3rd, 2005, 11:53 AM
Just use any of the features block hacks and adjust your query to limit the returns to the cat your want like so'

AND cat='511'

dkmulford
June 6th, 2005, 04:09 PM
Chuck,

I did a search for "features block hack" and I didn't come up with anything. Are you refering to the PAL hack that Michael posted at the link below?

http://www.photopostdev.com/showthread.php?p=5525#post5525

Thanks,
Darren

Chuck S
June 6th, 2005, 04:29 PM
I am saying you can use the inc_features.php file as a model or any of the random thumbnailer hacks as a model. You just adjust the query as I noted to adjust it to only pull from one category

dkmulford
June 7th, 2005, 07:08 AM
Ah, you are talking about the hack used to display thumbnails in VB, etc.? ...that is one discussion I never followed. I'll do a search on inc_features.php to find it. Thanks.

...I am also wondering if I could hack one of the PAL files?

Darren

Chuck S
June 7th, 2005, 09:38 AM
Your best bet to hack a script to display thumbs elsewhere is to mock the inc-features script or get a compatible thumbnailer hack off photopostdev.com

dkmulford
June 7th, 2005, 10:57 AM
Chuck,

I'm only wanting to show random photos/videos from a specific category on PP's index page only. .....I really don't need to show them anywhere else. This is why I am wondering if I could just mod the PALs.

Darren

Chuck S
June 7th, 2005, 11:09 AM
In my first post in this thread modify in pp-inc.php function display_gallery and add in the cat restrictor I state in the queries

dkmulford
June 7th, 2005, 11:17 AM
Thanks Chuck! I'll give it a try.

dkmulford
June 7th, 2005, 08:51 PM
Chuck,

I'm not quite sure where to add the "AND cat='511'"? See the bold below...this crashes.

Thanks,
Darren


default:
if ( !isset($cat) || empty($catquery) ) {
$group_title = "{$Globals['pp_lang']['random']}";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,views,height,width, id*0+RAND() as rand_col FROM {$Globals['pp_db_prefix']}photos WHERE approved='1' $exclude_cat ORDER BY rand_col DESC AND cat='535'";
break;
}
else {
$group_title = "{$Globals['pp_lang']['random']} - $catname";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,views,height,width, id*0+RAND() as rand_col FROM {$Globals['pp_db_prefix']}photos WHERE approved='1' $userq $exclude_cat AND cat in ($catquery) ORDER BY rand_col DESC AND cat='535'";
break;