Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [katakombe] The most popular categories: Edit Log

Here is the list of edits for this post
Re: [katakombe] The most popular categories
Hi,

Untested, but give this a go;

get_top_cat_loop
Code:
sub {
my $tbl = $DB->table('Category');
$tbl->select_options("ORDER BY Number_of_Links DESC LIMIT 10");

my $sth = $tbl->select( GT::SQL::Condition->new('Direct_Links','>','0','FatherID,'=','0') ) || die $GT::SQL::error;

my @loop;
while (my $hit = $sth->fetchrow_hashref) {
$hit->{URL} = $CFG->{build_root_url} . '/' . $tbl->as_url($hit->{Full_Name}) . '/' . $CFG->{build_index};
push @loop, $hit;
}
return { top_cat_loop => \@loop }
}


..then call with:

Code:
<%get_top_cat_loop%>
<ul>
<%loop top_cat_loop%>
<li><a href="<%URL%>"><%Name%></a></li>
<%endloop%>
</ul>

Hopefully that'll 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!

Last edited by:

Andy: Oct 8, 2008, 8:01 AM

Edit Log: