Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [shimmy1] List Main Categories on every page: Edit Log

Here is the list of edits for this post
Re: [shimmy1] List Main Categories on every page
Hi,

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!

Last edited by:

Andy: Jul 16, 2013, 6:00 AM

Edit Log: