Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Limiting the character length of <%if URL%>

Quote Reply
Limiting the character length of <%if URL%>
I list the URL of links in my directory in the category view (directly below the short description). You can see what I mean here. The problem is, some websites have extemely long URL, which really messes up the design, as it pushes the rest of the content down (gets hung up on a <div>).

Is there a way I can use a global to reduce the length of <%if URL%> to be under a certain character length - perhaps 60 characters?

So for the link in the example above,

http://www.cwf.ca/abcalcwf/doc.nsf/(Publications)/A1ECE16EAE...

rather than,

http://www.cwf.ca/abcalcwf/doc.nsf/(Publications)/A1ECE16EAE5B63F987256E450080A82F/$file/Counting%20the%20Cost.pdf

Thanks!
Quote Reply
Re: [mapleleafweb] Limiting the character length of <%if URL%> In reply to
short_url

sub {
my $tags = shift;

my $url = $tags->{URL};
$url =~ s,^(.{50}).*$,$1...,;

return $url;

}

Not my global, I believe Paul wrote this one.

Last edited by:

rascal: Aug 16, 2006, 9:13 AM
Quote Reply
Re: [rascal] Limiting the character length of <%if URL%> In reply to
thanks Rascal, Paul!