Hi All-
I have two globals that are for posting the last 5 links and also the last # by category.
I have recently changed my format to allow for non-website listings to appear on the detail page. Problem is now the globals only want to jump to a link and they can't differentiate between the links and non-links listings. Here are the globals, the last 5 I believe Andy gave to me. How can I make them work for both?
Last 5
sub {
my $LinkOwner = shift;
my $sth;
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY ID DESC', 'LIMIT 5');
if ($LinkOwner) { $sth = $link_db->select( { isValidated => "Yes", LinkOwner => $LinkOwner } );
} else {
$sth = $link_db->select( { isValidated => "Yes" } );
}
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}
last by category
sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $cat = shift;
my $search_db = $DB->table('CatLinks', 'Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 3');
$sth = $search_db->select ( { isValidated => 'Yes', CategoryID => $cat });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('newestlink', $link);
}
return $output;
}
Could I also get one for Cool links?
Thanks!!
I have two globals that are for posting the last 5 links and also the last # by category.
I have recently changed my format to allow for non-website listings to appear on the detail page. Problem is now the globals only want to jump to a link and they can't differentiate between the links and non-links listings. Here are the globals, the last 5 I believe Andy gave to me. How can I make them work for both?
Last 5
sub {
my $LinkOwner = shift;
my $sth;
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY ID DESC', 'LIMIT 5');
if ($LinkOwner) { $sth = $link_db->select( { isValidated => "Yes", LinkOwner => $LinkOwner } );
} else {
$sth = $link_db->select( { isValidated => "Yes" } );
}
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}
last by category
sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $cat = shift;
my $search_db = $DB->table('CatLinks', 'Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 3');
$sth = $search_db->select ( { isValidated => 'Yes', CategoryID => $cat });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('newestlink', $link);
}
return $output;
}
Could I also get one for Cool links?
Thanks!!