I am trying to make a drop down list for each category that shows all the links in that category's sub-categories.
From reading the boards and resource area I came up with this global:
----------------------------------------------------
sub {
my $tags = shift;
my $cat = $tags->{'Full_Name'};
my $output;
my $sth;
my $link;
use GT::SQL::Condition;
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('GROUP BY LinkID ORDER BY Add_Date DESC Limit 5');
$sth = $search_db->select (['Links.ID', 'Links.Description', 'Links.Title', 'Links.Add_Date', 'Category.Full_Name', 'Category.Name'], GT::SQL::Condition->new(['Full_Name', 'LIKE', $cat .'%'], ['isValidated', '=', 'Yes']));
while ($link = $sth->fetchrow_hashref)
{
# Set the detailed_url
my $detailed_url = "http://mylink.com/cgi-bin/page.cgi?g=Detailed-$link->{'ID'}.html&d=1";
$output .= qq~<option value="$detailed_url"> $link->{'Name'} :: $link->{'Title'} ~;
}
return $output;
}
------------------------------------
This only shows the last 5 links in the category and subcategories. I need it to show all in only the subcategories. The limit 5 makes it so only 5 show up, but if I take it out I get ALL links in the whole database. If I make it limit 20 then it shows the last 20 links in the whole database, you get the idea.
Anyone know how to fix this... basicly I just need it to spit out a list of all subcategory links and url's for whatever category I am in.
Thanks for any help you can give.
From reading the boards and resource area I came up with this global:
----------------------------------------------------
sub {
my $tags = shift;
my $cat = $tags->{'Full_Name'};
my $output;
my $sth;
my $link;
use GT::SQL::Condition;
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('GROUP BY LinkID ORDER BY Add_Date DESC Limit 5');
$sth = $search_db->select (['Links.ID', 'Links.Description', 'Links.Title', 'Links.Add_Date', 'Category.Full_Name', 'Category.Name'], GT::SQL::Condition->new(['Full_Name', 'LIKE', $cat .'%'], ['isValidated', '=', 'Yes']));
while ($link = $sth->fetchrow_hashref)
{
# Set the detailed_url
my $detailed_url = "http://mylink.com/cgi-bin/page.cgi?g=Detailed-$link->{'ID'}.html&d=1";
$output .= qq~<option value="$detailed_url"> $link->{'Name'} :: $link->{'Title'} ~;
}
return $output;
}
------------------------------------
This only shows the last 5 links in the category and subcategories. I need it to show all in only the subcategories. The limit 5 makes it so only 5 show up, but if I take it out I get ALL links in the whole database. If I make it limit 20 then it shows the last 20 links in the whole database, you get the idea.
Anyone know how to fix this... basicly I just need it to spit out a list of all subcategory links and url's for whatever category I am in.
Thanks for any help you can give.