Hi Andy,
I' using this global for showing the newest links on my page.
At the moment they are sorted by ID
Sometimes users add links and I can not validate them, cause some information is missing.
When I validate these links later, they are not on the top of the page, cause they are sorted by ID.
Is there a better way for sorting the new links?
Would be great, if the last validated link is on top of the list...
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ID DESC Limit 50');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 100) {
$link->{Title} = substr($link->{Title}, 0, 100) . '...';
}
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}
Thanks
Matthias
Matthias
gpaed.de
I' using this global for showing the newest links on my page.
At the moment they are sorted by ID
Sometimes users add links and I can not validate them, cause some information is missing.
When I validate these links later, they are not on the top of the page, cause they are sorted by ID.
Is there a better way for sorting the new links?
Would be great, if the last validated link is on top of the list...
Code:
sub { # Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ID DESC Limit 50');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 100) {
$link->{Title} = substr($link->{Title}, 0, 100) . '...';
}
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}
Thanks
Matthias
Matthias
gpaed.de