Occasionally somebody posts a very long URL on my site.
For
example:
Beautiful Yamaha 581 <
flute_gal@msn.com> IL USA -
http://www.larryandnatalie.com/isapi.dll/c/content/f/viewproperty/siteid/wb5KAM/contentclass/PICT/contentid/ZZZZZZVR/propertyname/Original/~/yamaha_58_page_11_jpg.jpg - Wednesday, March 26, 2003
Great sounding YLF 581. This is a professional solid silver flute with a CY headjoint, french open holes, pointed arms, white gold springs, inline G, and a C foot. I just had it serviced and adjusted and the pads are in great shape. This flute has a beautiful and bright sound. Asking price is $1200 USD.
=====
I'd like to modify my script to have a set value for the display, for example if the URL is over 53 characters long it gets changed to display the first 35 characters, then ... in the middle, then the last 15 characters. The above URL would then display like this in the browser with the original URL unchanged in the HTML:
http://larryandnatalie.com/isap...page_11_jpg.jpg
=====
The part of the my MySQL script that deals with the URL ($val
5) looks like this:
my $page_link;
if (defined ($val[5]) && $val[5] ne "")
{
# construct link if value is not NULL (undef) or empty
$page_link = a ({-href => "$val[5]"}, $val[5]);
}
### other variables here ### then
print " - $page_link" if defined ($page_link);
=====
Anybody know how to do this?
Many thanks in advance,
-Bob
2003-04-06 edit by ybiC - add code and small tags
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.