Gossamer Forum
Quote Reply
Suggest category
It occured to me that Ivan's great Suggest query can be used to make an alternative listing of categories. Rather than showing search log terms, it would show category names.

I have tried this code:
Code:

my $t = $DB->table('Category');
$t->select_options('ORDER by Name DESC', 'LIMIT 25');
my $q = $IN->param('query');
my $cond = GT::SQL::Condition->new( 'Full_Name', 'LIKE', "$q%");
my $sth = $t->select($cond);
my $path = $sth->as_url($result->{Full_Name});
my $base = 'http://slashdemocracy.org/links/';
print "Content-Type: text/xml\n\n";
if ($t->hits) {
print qq|<ul class="LSRes">|;
while (my $result = $sth->fetchrow_hashref) {
print qq|<li onmouseover="liveSearchHover(this)" onclick="liveSearchClicked(this)"><a href="$base$path" name="$result->{Full_Name}">$result->{Full_Name}</a> </li>\n|;
}
print qq|</ul>|;
}

It doesn't work, but if I remove the red line, it does. That is, it does work and does show the categories, but the links only work if the category names are "straight", and does not contain spaces. Unfortunately, most of my categories contains spaces.

So, can anyone help me explaining how I get Full_Name to become worth its name? (it should be named "Full Name" ...)?

John
Subject Author Views Date
Thread Suggest category gotze 3307 Jan 8, 2005, 12:39 PM
Thread Re: [gotze] Suggest category
jdgamble 3259 Jan 8, 2005, 2:39 PM
Post Re: [jdgamble] Suggest category
gotze 3258 Jan 8, 2005, 3:06 PM
Thread Re: [gotze] Suggest category
brewt 3256 Jan 8, 2005, 4:37 PM
Thread Re: [brewt] Suggest category
gotze 3251 Jan 8, 2005, 4:55 PM
Post Re: [gotze] Suggest category
Jag 3228 Jan 9, 2005, 9:27 AM
Post Re: [brewt] Suggest category
jdgamble 3248 Jan 8, 2005, 4:56 PM