Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #1  
Old 04-15-2005, 06:10 AM
derevaun Offline
pp regular
 
Join Date: Mar 2005
Location: oly, wa
Posts: 47
Static text with categories on Browse

I'm using my categories to identify the cameras and film, and I wanted to have a special page for each camera with static text and images, plus the thumbnails for images in that category. So I made an addon for my site (http://asiftosay.com) that does it, probably in the least commonsense way possible :wink:

Code:
if ($_GET['category']) {
  $file_to_read = '/long/path/from/root/to/descriptions/'.$_GET['category'].'.html';
  $frag_to_add = file_get_contents($file_to_read);
}
else {
  $frag_to_add = "";
}

$tpl = ereg_replace("<CATEGORY_DESCRIPTION>",$frag_to_add,$tpl);
It inserts a file whose filename matches the category number, e.g. 23.html. The file contains a division element with text, images, etc. I use the tag on the browse_template just before the thumbnails. It works, although I had to use the entire path from the root to the folder, which I titled "descriptions." Anyway, I suspect there's a better way to do it, so if it seems worth doing, be my guest. If you want to use it and need more explanation, just ask.
Reply With Quote
  #2  
Old 04-15-2005, 08:42 AM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
From security reasons it would be better to add such code:
Code:
if ($_GET['category']) {
  $file_to_read = '/long/path/from/root/to/descriptions/'.basename($_GET['category']).'.html';
  $frag_to_add = file_get_contents($file_to_read);
}
else {
  $frag_to_add = "";
}

$tpl = ereg_replace("<CATEGORY_DESCRIPTION>",$frag_to_add,$tpl);
Change is made in $file_to_read value (I can't colorize it coz [code] block can't have formating inside).
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
  #3  
Old 04-18-2005, 03:52 PM
derevaun Offline
pp regular
 
Join Date: Mar 2005
Location: oly, wa
Posts: 47
Thanks!
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 05:53 PM.

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