Is there a way to call a few of the links from a category to be displayed as part of the category description?
Apr 4, 2005, 11:56 PM
Veteran / Moderator (18441 posts)
Apr 4, 2005, 11:56 PM
Post #2 of 2
Views: 1317
Kinda =)
In subcategory.html, change <%Description%> to <%get_related_links($ID)%>.
Then, make a new global called get_related_links.
my $catid = $_[0];
my $cltbl = $DB->table('CatLinks');
$cltbl->select_options('ORDER BY RAND(CURTIME())','LIMIT 5');
my @links;
while (my $hit = $sth->fetchrow_hashref) {
my $link = $DB->table('Links')->get($hit->{LinkID});
push @links, $link;
}
return { rand_links => \@links };
}
Then, use;
<%loop rand_links%>
<%include link_short.html%>
<%endloop%>
<%endif%>
..and then just make a new template called link_short.html =)
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!
In subcategory.html, change <%Description%> to <%get_related_links($ID)%>.
Then, make a new global called get_related_links.
Code:
sub { my $catid = $_[0];
my $cltbl = $DB->table('CatLinks');
$cltbl->select_options('ORDER BY RAND(CURTIME())','LIMIT 5');
my @links;
while (my $hit = $sth->fetchrow_hashref) {
my $link = $DB->table('Links')->get($hit->{LinkID});
push @links, $link;
}
return { rand_links => \@links };
}
Then, use;
Code:
<%if rand_links%> <%loop rand_links%>
<%include link_short.html%>
<%endloop%>
<%endif%>
..and then just make a new template called link_short.html =)
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!