PDA

View Full Version : Categories description


Mikey
07-29-2005, 09:03 PM
Good evening,

I want to add a description to a category. I created the table categories_description and created the input boxes in the admin section to add the description. That part works, I can add a description to a category.

No I want to show this data from my template, but I'm not sure how I should do this. Who can point me in the right direction?

Thanks.
Marco

derevaun
08-02-2005, 04:02 AM
I did it a different, less efficient way: I made an add-on to read in a text file whose filename matches the number of the category as found in the GET data.


if ($_GET['category']) {
$file_to_read = '/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);


I make a text file for each category that needs a description, stored in a new folder called 'descriptions.' The text files are HTML snippets with lists, IMGs, etc. Good luck!