HTML attribute / url safe wordwrap function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Howdy,

Yes, I've googled - and yes, I've searched the archives - but didn't
find a solution for my problem. Here's the deal:

On a website ppl can react on articles and post messages. The content
of a message is given to a function which parses it all, taking care
of long "words" which could mess up the interface. Or actually - it
does do that. It all wraps perfectly fine with the following lines of
code:

<?php
 $txt = 'website ppl can react on articles <a
href="http://aspn.activestate.com/ASPN/docs/PHP/function.wordwrap.html";>wordwrap</a>';
 $txt = preg_replace('#(<a.*>)((http|ftp|www).{13})(.*)(.{20})(</a>)#U',
' $1$2(...)$5$6 ', $txt);
 $txt = preg_replace('/([\.\?\w\)\(\:\',!\-\=]{30})/', '$1 ', $txt);
?>

Unfortunately, this also breaks the weblink address. So, some
wordwrapping function that doesn't do that would be cool. So far, I
haven't been able to find it or create it myself.

Somebody out there feels like giving it a shot?

Thanks,
Wouter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux