Hi,
Are you saying you want to do a loop of <%category_loop%>, and inside that , then loop the links for that category? If so, you could do it with a new global:
get_cat_links
my $cat = shift;
my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;
my $db_obj = $DB->table('Links','CatLinks','Category');
$db_obj->select_options ('ORDER BY Title DESC LIMIT 20');
my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $cond2 = GT::SQL::Condition->new('isValidated','=','Yes');
my $sth = $db_obj->select (['Links.*'], $cond, $cond2 ) || die $GT::SQL::error;
my @cats;
while (my $hit = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
push @cats, $hit;
}
return { link_sub_loop => \@cats }
}
Then call something like:
<%include subcategory.html%>
<%get_cat_links ($ID)%>
<%if link_sub_loop.length%>
<%loop link_sub_loop.length%>
<%include link.html%>
<%endloop%>
<%endif%>
Untested, but it should work
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Are you saying you want to do a loop of <%category_loop%>, and inside that , then loop the links for that category? If so, you could do it with a new global:
get_cat_links
Code:
sub { my $cat = shift;
my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;
my $db_obj = $DB->table('Links','CatLinks','Category');
$db_obj->select_options ('ORDER BY Title DESC LIMIT 20');
my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $cond2 = GT::SQL::Condition->new('isValidated','=','Yes');
my $sth = $db_obj->select (['Links.*'], $cond, $cond2 ) || die $GT::SQL::error;
my @cats;
while (my $hit = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
push @cats, $hit;
}
return { link_sub_loop => \@cats }
}
Then call something like:
Code:
<%loop category_loop%> <%include subcategory.html%>
<%get_cat_links ($ID)%>
<%if link_sub_loop.length%>
<%loop link_sub_loop.length%>
<%include link.html%>
<%endloop%>
<%endif%>
Untested, but it should work
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!