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

Priority Links by Category ?

Quote Reply
Priority Links by Category ?
I've modified a couple of existing globals found in the forum and resources section to give me the Priority links by category, but I need to incorporate variations in the display.

sub {
# Displays the isPriority links per category on the category home pages.
my $id = shift;
my $db = $DB->table ('Links','CatLinks');
$db->select_options ('ORDER BY isPriority DESC', 'LIMIT 10');
my $sth = $db->select ( { isPriority => 'Yes'}, { 'CatLinks.CategoryID' => $id}, ['Links.ID', 'Links.Title', , 'Links.URL'], { isValidated => 'Yes'} );
my $premium;
while (my ($id,$name,$url) = $sth->fetchrow_array) {
$premium .= "<a href='$url'>$name</a><br>";
}
return $premium;
}


The out put / display I'm chasing is in the following global

sub {
# Displays the isPriority logo and links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC Limit 5');
$sth = $search_db->select ( { isPriority => 'Yes'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link2', $link);
}
return $output;
}


So what I need to do is use the output type in the 2 nd global and incorporate it in the 1 st one.

Any pointers would be appreciated.

Regards

minesite
Quote Reply
Re: [minesite] Priority Links by Category ? In reply to
What I was trying to achieve was to be able to display the Priority / Premium listed sites Logo / Graphic per category. This will do it:[ Modified $premium global ] Graphic column being "Logo"

sub {

# Displays the isPriority listed links logo per category on the category home page.

my $id = shift;

my $db = $DB->table ('Links','CatLinks');

$db->select_options ('ORDER BY isPriority DESC', 'LIMIT 10');

my $sth = $db->select ( { isPriority => 'Yes'}, { 'CatLinks.CategoryID' => $id}, ['Links.ID', 'Links.Logo', 'Links.Title', , 'Links.URL'], { isValidated => 'Yes'} );

my $premium;

while (my ($id,$logo,$name,$url) = $sth->fetchrow_array) {

$premium .= "<a href='http://www.your_site.com/cgi-bin/jump.cgi?ID=$id' target='_blank'><img src='$logo' border='0'></a><br>";

}

return $premium;

}





Regards

minesite
Quote Reply
Re: [minesite] Priority Links by Category ? In reply to
Did you figure the solution?

You really can't include the oupt of one global in another, without using functions, but you can combine the two routines, and return a single value that has done it all.

I'm not sure what you are trying to do, so I can't be more specific :)


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Priority Links by Category ? In reply to
"Did you figure the solution? "

Pugdog, Yes I did. What I was trying to achieve was to be able to display the logo / graphic for the Priority / Premium listed sites and list them in their particular category.

The above global will do it.
[ Its a Modified $premium global ] Graphic column being "Logo"






Regards

minesite
Quote Reply
Re: [minesite] Priority Links by Category ? In reply to
With this one it is easier to customize the output.


sub {
# Displays the isPriority links.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC','Limit 10');
$sth = $search_db->select ( { isPriority => 'Yes'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}


Regards

minesite