Here's one way of doing it by using and altering the list cat sub in db_utils. This will give a list of top level categories anywhere on your templates:
In db_utils.pl add the following sub:
sub menu {
# --------------------------------------------------------
#
my (%c, @fields);
open (DB, "<$db_category_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
@fields = &split_decode ($_);
$c{$fields[$db_main_category]}++;
}
close DB;
foreach $field (sort keys %c) {
if ($field =~ m,^([^/]*)$,) {
$field2 = &build_clean($field);
$category_list .= qq|<a href= "$build_root_url/$field">$field2</a>
|;
}
}
return $category_list;
}
Then in sub html templates add in the globals section at the very top:
menu => &menu,
Then just add <%menu%> where ever you want the list of category links to appear.
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml