coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: MarianneC on August 28, 2008, 05:12:09 AM

Title: [Solved]: Making non-www web address clickable?
Post by: MarianneC on August 28, 2008, 05:12:09 AM
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
Title: Re: Making non-www web address clickable?
Post by: johanz on August 28, 2008, 11:50:25 AM
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
Title: Re: Making non-www web address clickable?
Post by: MarianneC on August 29, 2008, 05:16:37 AM
Thanks Johanz.  In our case, other folks don't submit, so that is less of a risk.  But I do understand your point.   :)
Title: Re: Making non-www web address clickable?
Post by: Nibbler on August 29, 2008, 12:24:54 PM
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);
Title: Re: Making non-www web address clickable?
Post by: MarianneC on August 29, 2008, 02:05:15 PM
Thank you, Nibbler!  That works great for us!
Title: Re: [Solved]: Making non-www web address clickable?
Post by: Joachim Müller on August 29, 2008, 09:13:11 PM
@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.
Title: Re: [Solved]: Making non-www web address clickable?
Post by: MarianneC on August 29, 2008, 11:05:32 PM
Thanks Joachim - eventually I will get the hang of all this.