I found this thread this morning in the mods section AFTER struggling with the same problem and coming up with my own solution.
Here's what I did:
Opened category.def and added one field thus:
# Database Definition: CATEGORIES
# --------------------------------------------------------
# Definition of your database file.
Û_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', ''],
Icon => [8, 'alpha', 40, 75, 0, 'http://www.barline.com/icons/', '']
);
Then I opened site_html_templates.pl and in sub site_html_print_cat added one if statement:
# Then we print out the name linked, new if it's new, and popular if its popular.
if (@{$category{$subcat}}[8] =~ ".gif") {
$output .= qq|<dl><dt><img src="@{$category{$subcat}}[8]"><a href="$url">$category_name</a> ($numlinks) |;
}
else{
$output .= qq|<dl><dt><a href="$url">$category_name</a> ($numlinks) |;
}
$output .= qq|<small><sup><font color="red">new</font></sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<dd><span>$description </span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl>|;
I like my solution because it doesn't require one to code category names into site_html_templates.pl. This maintains maximum flexibility of the database structure. You decide which category gets which icon when adding or modifying categories in the Administrative Control Panel. The URL fragment entered in the field added to the database definition saves typing time when adding records. At that point you will have to type 'youricon.gif'.
The if statement tests for the substring '.gif' in the Icon field, and if it is found prints the contents of field 8 (the Icon field) in an image tag. If it is not found, no image tag is added. This allows you to leave field 8 blank in any records you choose.
I've tested this and it works for me. I hope it is useful to someone else.
Daniela Muhling