I just added the "show cats" feature, to see the first 25 suggested categories.
Also, I noticed I have some problems with the $in and %in variables,they work, but they are not kosher (never program when really, really tired).
To add the "show_cats" feature, just put:
if ($in{'Show_Cats'}) {
$show_cats = &show_cats(\%in);
}inside the "else" (## form is incomplete) portion of the first if test, and add the passed tag:
&site_html_new_cat_form ({ Output=>$show_cats, Category => $category, %in }, $dynamic)
To the printout, and make sure to add:
<%if Output%><%Output%><%endif%> to your new_cat.html form.
and finally, here is the ugly little hack to add to the bottom of the new_cat.cgi file:
# --------------------------------------------------------
my ($in, $dynamic) = @_;
my ($new_cat, $sth, $categories, $output, $hit, $numhits);
# Connect to the database.
$new_cat = new Links::DBSQL $LINKS{admin_root_path} . "/defs/New_Cat.def";
$sth = $new_cat->prepare('SELECT * FROM New_Cat ORDER BY parent_category,new_category LIMIT 0, 25');
$sth->execute;
($numhits) = $sth->fetchrow_array;
$output = '';
if ($numhits) {
while ($hit = $sth->fetchrow_hashref) {
$output .= $hit->{'Parent_Category'} . '/<B>' . $hit->{'New_Category'}. "</B><BR>\n";
}
} else {
$output .= 'No Categories Suggested yet.';
}
return($output);
}
http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/
Also, I noticed I have some problems with the $in and %in variables,they work, but they are not kosher (never program when really, really tired).
To add the "show_cats" feature, just put:
Code:
my $show_cats if ($in{'Show_Cats'}) {
$show_cats = &show_cats(\%in);
}
&site_html_new_cat_form ({ Output=>$show_cats, Category => $category, %in }, $dynamic)
To the printout, and make sure to add:
<%if Output%><%Output%><%endif%> to your new_cat.html form.
and finally, here is the ugly little hack to add to the bottom of the new_cat.cgi file:
Code:
sub show_cats { # --------------------------------------------------------
my ($in, $dynamic) = @_;
my ($new_cat, $sth, $categories, $output, $hit, $numhits);
# Connect to the database.
$new_cat = new Links::DBSQL $LINKS{admin_root_path} . "/defs/New_Cat.def";
$sth = $new_cat->prepare('SELECT * FROM New_Cat ORDER BY parent_category,new_category LIMIT 0, 25');
$sth->execute;
($numhits) = $sth->fetchrow_array;
$output = '';
if ($numhits) {
while ($hit = $sth->fetchrow_hashref) {
$output .= $hit->{'Parent_Category'} . '/<B>' . $hit->{'New_Category'}. "</B><BR>\n";
}
} else {
$output .= 'No Categories Suggested yet.';
}
return($output);
}
http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/