Gossamer Forum
Quote Reply
laura's site map
Very nice script from Laura from the UK highstreet.
Since I am using the Links SQL in different languages, I would need to parse a parameter to tell the script which top category to take, such as <%global('1')%> to choose only the categories with the top category 1.

Cheers



sub {
# -------------------------------------------------------------------
my $tags = shift;
my $top_category = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Full_Name');
my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','ID','Name'] );
my $output=qq~<table><tr valign=top><td width="25%"><table>~;
my $i=0;
while (my
($root_cat,$ID,$heading) = $sth->fetchrow_array) {
$i++;
my $url1 =
$cat_db->as_url($root_cat);
$output.= qq~<tr><td colspan=2><font size=-1><b><a href="$CFG->{build_root_url}/$url1" class="toc">$heading</a></b></font></td></tr>~;
$cat_db->select_options ('ORDER BY Full_Name');
my $sth2 = $cat_db->select ( { FatherID => $ID}, ['Full_Name','ID','Name'] );
while (my ($cat,$id,$heading1) = $sth2->fetchrow_array) {
# my $link_count = $DB->table('CatLinks')->count ( {CategoryID => $id});
my $url = $cat_db->as_url($cat);
$output .= qq~<tr><td>&nbsp;</td><td><font size=-2><a href="$CFG->{build_root_url}/$url" class="toc">$heading1</a></font></td></tr>~;
$cat_db->select_options ('ORDER BY Full_Name');
my $sth3 =
$cat_db->select ( { FatherID => $id}, ['Full_Name','ID','Name'] );
while (my ($cat2,$id2,$heading2) = $sth3->fetchrow_array) {
# my $link_count = $DB->table('CatLinks')->count ( {CategoryID => $id2});
my $url2 = $cat_db->as_url($cat2);
$output .= qq~<tr><td>&nbsp;</td><td><font size=-2>- <a href="$CFG->{build_root_url}/$url2" class="toc">$heading2</a></font></td></tr>~; }
}
if (($i eq '13')or ($i eq '19') or ($i eq '33') or ($i eq '40')){
$output.=qq~</table></td><td width="25%"><table align=top>~;}
}
$output.="</table></td></tr></table>";
return
$output;
}
Subject Author Views Date
Post laura's site map vacationrentals 1323 Mar 12, 2004, 10:14 AM