Dariusz wrote:[color=blue]
> I have a guestbook on one of my sites where the entires are formatted
> to be x pixles in width. Now the text is input and output from a
> "blob" field from a database... but when people input long URL's into
> their entries, the formatting of the page is ruined.
>
> Can anyone suggest a way for PHP to "read through" the text and
> substitute a URL with a short text link, but still keeping the URL so
> it's clickable? From my observations, the URL's may or may not
> (usually not) have the prefix
http://.
>
> All I can think of is for PHP to count how many consecutive characters
> there are before a "space" character, and substitute if it's over x
> characters in length. But I don't know if this is possible.
>
> Would prefer suggestions how to do it rather than actual code (I want
> some challenge after all).
>
> Thanks.
>
> Dariusz[/color]
Have a look at this:
http://www.php.net/manual/en/function.preg-replace.php
Read the comment by syd_egan. Now, I know you didn't want actual code, but
there are several challenges here, one of them is that syd_egan's code
presumes that either the http:// or ftp:// schemes are present, so there is
your first challenge. Good luck.