Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Last 10 links ...

Quote Reply
Last 10 links ...
Hi,

I like to use a mod to show the newest 10 Links and the description on my homepage.

I took this code from the forum:

Code:
sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Add_Date DESC', 'LIMIT 10');
my $sth = $table->select;
my @output;
while (my $link = $sth->fetchrow_hashref) {
$link->{Title} = (length $link->{Title} > 30) ? substr($link->{Title},0,30) . ' ...' : $link->{Title};
$link->{Description} =~ s/^(\w+\s\w+\s\w+\s\w+\s\w+).*$/$1.../;
push (@output, $link);
}
return { lastlinks10_loop => \@output };
}

It works almost well but shows the first two links with shortened description and the next links with full description ...

I like to shorten the description evreyweher ... what is wrong and which things I've to alter to change the length of description and title?

thx

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de