Hi,
Untested, but something like this should do the trick:
get_top_cats
my @loop;
my $Category = $DB->table("Category");
$Category->select_options("ORDER BY Name");
my $sth = $Category->select( { FatherID => 0 } );
while (my $cat = $sth->fetchrow_hashref) {
$cat->{URL} = $CFG->{build_root_url} . "/" . $Category->as_url( $cat->{Full_Name} ) . "/";
push @loop, $cat;
}
return { top_cat_loop => \@loop }
}
Call with:
<%loop top_cat_loop%>
<a href="<%URL%>"><%Name%></a><br />
<%endloop%>
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!
Untested, but something like this should do the trick:
get_top_cats
Code:
sub { my @loop;
my $Category = $DB->table("Category");
$Category->select_options("ORDER BY Name");
my $sth = $Category->select( { FatherID => 0 } );
while (my $cat = $sth->fetchrow_hashref) {
$cat->{URL} = $CFG->{build_root_url} . "/" . $Category->as_url( $cat->{Full_Name} ) . "/";
push @loop, $cat;
}
return { top_cat_loop => \@loop }
}
Call with:
Code:
<%get_top_cats%> <%loop top_cat_loop%>
<a href="<%URL%>"><%Name%></a><br />
<%endloop%>
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!