Gossamer Forum
Quote Reply
Need help with global >>
Hello

I've put together a global to display the most popular links selected within a defined category. It works great except for one problem. The links being displayed are returning the actual URL instead of the reference to the link through the jump.cgi

I'm hoping someone could help in getting this to display the jump.cgi call ....

sub {
my $id = shift;
my $db = $DB->table ('Links','CatLinks');
$db->select_options ('ORDER BY Hits DESC', 'LIMIT 30');
my $sth = $db->select ( { 'CatLinks.CategoryID' => $id}, ['Links.ID', 'Links.Title', , 'Links.URL'], { isValidated => 'Yes', has_price => 'Yes'} );
my $popularcategory;
while (my ($id,$name,$url) = $sth->fetchrow_array) {
$popularcategory .= "<a href='$url'>$name</a><br>"; }
return $popularcategory; }

called with <%popular (4)%> to display popular links in category id 4, or <%popular ($ID)%> to display popular links in category <%ID%>.

Thanks for any help getting this fixed up!
Quote Reply
Re: [Jonze] Need help with global >> In reply to
Hi,

You just need to change

$popularcategory .= "<a href='$url'>$name</a><br>";

to

$popularcategory .= qq~<a href="$CFG->{db_cgi_url}/jump.cgi?ID=$id">$name</a><br>~;

Last edited by:

afinlr: Apr 28, 2003, 11:05 AM
Quote Reply
Re: [afinlr] Need help with global >> In reply to
Ohhhh...I see! That worked perfectly Laugh

Thank you very, very much!!!

Jonze