[Solved]: Making non-www web address clickable? [Solved]: Making non-www web address clickable?
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

[Solved]: Making non-www web address clickable?

Started by MarianneC, August 28, 2008, 05:12:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarianneC

Hi,

I've noticed that displayimage.php makes any www.somewebaddress.com clickable.  That's great.  However, if the web address is simply somewebaddress.com or something.somewebaddress.com, it comes out as straight text. 

How can I make either form clickable?

Thank you!
Marianne

johanz

But what if there is text like I went to school.Commie went away
It will be made url too. I don't really understand why you want this.
Just add http:// to link, I think it will become link too

MarianneC

Thanks Johanz.  In our case, other folks don't submit, so that is less of a risk.  But I do understand your point.   :)

Nibbler

Edit include/functions.inc.php, find


        $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" rel=\"external\">www.\\2.\\3\\4</a>", $ret);


change to


        $ret = preg_replace("#([\n ])(www\.)?([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://\\2\\3.\\4\\5\" rel=\"external\">\\2\\3.\\4\\5</a>", $ret);

MarianneC

Thank you, Nibbler!  That works great for us!

Joachim Müller

@MarianneC: resolve your threads by clicking on the OK-tick in your initial posting on a thread. I did this for you. Do it yourself in the future.

MarianneC

Thanks Joachim - eventually I will get the hang of all this.