Code:
$output .= qq|</dt><dd><span class="descript">|;
if ($description =~ m,^\(([^\)]+)\)(\d)$,) {
($description, $style) = ($1, $2);
my $subcat_length = 40;
my $CATDB = new Links:
BSQL "$LINKS{admin_root_path}/defs/Category.def";
my $sth = $CATDB->prepare (qq! SELECT Name FROM Category WHERE Name REGEXP "^$cat/" !) or die $DBI::errstr;
$sth->execute() or die $DBI::errstr;
my $subcategories = ($sth->fetchall_arrayref)[0];
if ($#$subcategories >= 0) {
@subnames = split (/\|/, $description);
my ($length, $s) = 0;
foreach $category_name (@subnames) {
foreach (@$subcategories) {
($description eq "ALL" && $#subnames == 0) ?
($$_[0] =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
($$_[0] eq "$cat/$category_name" or next);
if ($style eq "1") {
$length += length($category_name);
($length > $subcat_length) and last;
}
if ($s > 0) {
$output .= qq~, ~ and $length += 2 if ($style == 1);
$output .= qq~<br>~ if ($style == 2);
}
elsif ($style == 1) { $output .= qq~ ~; }
$output .= qq~ ~ if ($style == 2);
$output .= qq~<a href="$category_url~.&build_clean_name($category_name).qq~/">$category_name</a>~;
$s++;
last if ($description ne "ALL" && $#subnames > 0);
}
}
if ($s < $#$subcategories) { $output .= qq~..~ if ($style == 1); }
}
}
else { $output .= qq|$description| if ($description !~ /^\s*$/sm); }
$output .= qq|</span></dd></dl>|;
version 2 for SQL of Subcategories Like Yahoo!..
umm.. just change this code in HTML_Templates.pm (sub site_html_print_cat):
Code:
$output .= qq|</dt>|;
$output .= qq|<dd><span class="descript">$description </span></dd>| if ($description !~ /^\s*$/sm);
$output .= qq|</dl>|;
with the above code..
also to avoid strict errors...
in
Code:
my ($output, $category_name, $category_url, $id, $name, $new, $links, $description, $i, $cat, $half, @subnames);
change to:
Code:
my ($output, $category_name, $category_url, $id, $name, $new, $links, $description, $i, $cat, $half, @subnames
, $style);
that's all!
to use.. it's pretty self explainatory.. well not really.. but.. ok here we go..
TO USE YAHOO STYLE..
in the categories description put:
(sub1|sub2|sub3)1
replacing each of the sub# with a subcategory.. you can put as many as you want.. or as few as you want..
you can also use:
(ALL)1
to make them list all in alphabetical order..
YAHOO STYLE USES
Code:
my $subcat_length = 40;
change the
40 to the maximum number of characters you want to appear on the subcategory line..
THE OTHER STYLE is simply an new space + an indent..
so it looks like
hello
hi
bye
buenos dias
adios
something like that..
just do
(sub1|sub2|sub3)2
or
(ALL)2
ahh... my first links sql mod.. (it was also my first links2 mod)
jerry