xoligy Posted September 18, 2008 Share Posted September 18, 2008 ok ive just decided to check the bbcode i added to a premade forum on a game and noticed two small issues that i need a hand fixing which are as follows: when a person types the link works but it tries to run from the directory that the game is in which brings up a not found page lol the next is if i type the link with http:// the link come out as follows www.google.co.uk [/ url] anyone know how i would fix these issues? function replace(txt){ $txt = str_replace("[b]", "<b>", $txt); $txt = str_replace("[/b]", "</b>", $txt); $txt = str_replace("[i]", "<i>", $txt); $txt = str_replace("[/i]", "</i>", $txt); $txt = str_replace("[u]", "<u>", $txt); $txt = str_replace("[/u]", "</u>", $txt); $txt = preg_replace("#\[color=(.+?)\](.+?)\[/color\]#is","<font color=\"\\1\">\\2</font>",$txt); // Set up the parameters for a URL search string // $URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'"; // Set up the parameters for a MAIL search string // $MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@"; // URL string // $txt = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" target="_blank">$1</a>', $txt); // Mail string // $txt = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '<a href="mailto:$1">$1</a>', $txt); // end // return $txt; } Quote Link to comment Share on other sites More sharing options...
dave_sticky Posted September 18, 2008 Share Posted September 18, 2008 when a person types the link works but it tries to run from the directory that the game is in which brings up a not found page // URL string // $txt = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" target="_blank">$1</a>', $txt); } This part should be fixable just by changing the code to: // URL string // $txt = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="http://$1" target="_blank">$1</a>', $txt); } Actually, If i've understood your second problem, it should fix both. Quote Link to comment Share on other sites More sharing options...
xoligy Posted September 18, 2008 Author Share Posted September 18, 2008 Thanks dave seems to of done the trick Quote Link to comment 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.