Reply
Max Character Output
Old 09-22-2005, 11:04 PM Max Character Output
Average Talker

Posts: 23
I have a small space at the bottom of my page, and content that is too long. I've tried everything I can think of, yet nothing seems to work. Can you help me write a code that will make each line a max length.

Example

I want to go from this:
- This Link is Short
- This Link is Really Really Really Long
- Another Really Really Long Link
- This Link is Really Really Long

To This:
- This Link is Short
- This Link is Real...
- Another Really R...
- This Link is Real...

(Including the '...' at the end)

Thank you so much!
portkey is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 09-23-2005, 12:54 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
What form are your links stored in? Are they in one long string variable like:
$link = '<a href="yoururl">Your Link Text</a>';

or are they in separate variables as in
$linkurl = 'yoururl';
$linktext = 'Your Link Text';

?

If they are separate you can just use the substr function:

PHP Code:
$linkhtml "<a href=\"$linkurl\">".substr($linktext,0,15) ."...</a>"
If not you need to separate out the link text from the rest of the URL which will probably require a regular expression. Post back here if you need a hand with that.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Scribble Pad MOD for phpBB (aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 09-23-2005, 06:02 PM
Average Talker

Posts: 23
Thanks! It worked perfectly!
portkey is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Max Character Output
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11919 seconds with 12 queries