pcman Posted July 29, 2008 Share Posted July 29, 2008 i want that http://www.google.com will be http://www.google.com automatic i try this: <?php function hyperlink(&$text) { // match protocol://address/path/file.extension?some=variable&another=asf% $text = preg_replace("/\s(([a-zA-Z]+:\/\/)([a-z][a-z0-9_\..-]* [a-z]{2,6})([a-zA-Z0-9\/*-?&%]*))\s/i", " <a href=\"$1\">$3</a> ", $text); // match www.something.domain/path/file.extension?some=variable&another=asf% $text = preg_replace("/\s(www\.([a-z][a-z0-9_\..-]* [a-z]{2,6})([a-zA-Z0-9\/*-?&%]*))\s/i", " <a href=\"http://$1\">$2</a> ", $text); return $text; } ?> but its doing a problam with: ?&_ how can i solve this?=[ Quote Link to comment https://forums.phpfreaks.com/topic/117151-how-to-call-a-php-function-on-click-of-a-hyperlink/ Share on other sites More sharing options...
Xurion Posted July 29, 2008 Share Posted July 29, 2008 i want that http://www.google.com will be http://www.google.com That makes no sense. Quote Link to comment https://forums.phpfreaks.com/topic/117151-how-to-call-a-php-function-on-click-of-a-hyperlink/#findComment-602553 Share on other sites More sharing options...
TempleDMDKrazd Posted July 29, 2008 Share Posted July 29, 2008 i want that http://www.google.com will be http://www.google.com That makes no sense. basically, i think what he means is for instance if someone types in "google.com" or "www.google.com" its just pure text, he wants to convert it into a href hyperlink so when he outputs it in html it shows as a hyperlink.. Quote Link to comment https://forums.phpfreaks.com/topic/117151-how-to-call-a-php-function-on-click-of-a-hyperlink/#findComment-602586 Share on other sites More sharing options...
DeanWhitehouse Posted July 29, 2008 Share Posted July 29, 2008 if that is what you want, i would advise using bbcode for it. And have the person put bbcode in instead. Quote Link to comment https://forums.phpfreaks.com/topic/117151-how-to-call-a-php-function-on-click-of-a-hyperlink/#findComment-602589 Share on other sites More sharing options...
pcman Posted July 29, 2008 Author Share Posted July 29, 2008 if that is what you want, i would advise using bbcode for it. And have the person put bbcode in instead. i need without bbcode and i need its will be look like that www . google .com replace to www.google.com (without spaces) Quote Link to comment https://forums.phpfreaks.com/topic/117151-how-to-call-a-php-function-on-click-of-a-hyperlink/#findComment-602599 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.