Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Re: Suggest a 'New' Category feature?

Quote Reply
Re: Suggest a 'New' Category feature? In reply to
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:
Code:
my $show_cats
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:

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/

Subject Author Views Date
Thread Suggest a 'New' Category feature? qango 5653 Oct 2, 2000, 8:21 AM
Thread Re: Suggest a 'New' Category feature?
Stealth 5570 Oct 2, 2000, 8:35 AM
Thread Re: Suggest a 'New' Category feature?
qango 5562 Oct 2, 2000, 10:34 AM
Thread Re: Suggest a 'New' Category feature?
Stealth 5544 Oct 2, 2000, 3:22 PM
Thread Re: Suggest a 'New' Category feature?
qango 5534 Oct 2, 2000, 4:27 PM
Thread Re: Suggest a 'New' Category feature?
Stealth 5525 Oct 2, 2000, 6:40 PM
Thread Re: Suggest a 'New' Category feature?
qango 5523 Oct 3, 2000, 2:06 AM
Post Re: Suggest a 'New' Category feature?
Stealth 5541 Oct 3, 2000, 7:55 AM
Thread Re: Suggest a 'New' Category feature?
pugdog 5526 Oct 3, 2000, 9:33 AM
Thread Re: Suggest a 'New' Category feature?
qango 5520 Oct 3, 2000, 10:35 AM
Thread Re: Suggest a 'New' Category feature?
pugdog 5519 Oct 3, 2000, 9:14 PM
Thread Re: Suggest a 'New' Category feature?
pugdog 5510 Oct 3, 2000, 10:33 PM
Thread Re: Suggest a 'New' Category feature?
pugdog 5489 Oct 3, 2000, 11:00 PM
Thread Re: Suggest a 'New' Category feature?
qango 5486 Oct 4, 2000, 1:56 AM
Thread Re: Suggest a 'New' Category feature?
pugdog 5508 Oct 4, 2000, 8:55 AM
Thread Re: Suggest a 'New' Category feature?
pugdog 5467 Oct 4, 2000, 9:44 AM
Thread Re: Suggest a 'New' Category feature?
Chef 5464 Oct 28, 2000, 11:01 AM
Post Re: Suggest a 'New' Category feature?
Stealth 5426 Oct 28, 2000, 11:12 AM