|
#1
|
|||
|
|||
|
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);
|
|
#2
|
||||
|
||||
|
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);
|
|
#3
|
|||
|
|||
|
Thanks!
|
| Post Reply |
| Thread Tools | |
|
|