Gubbins Posted April 10, 2009 Share Posted April 10, 2009 I have a file were all my bb codes are for my forum and the url part has never worked, i have this:- $txt = str_replace("[url]", "<url>", $txt); $txt = str_replace("[/url]", "</url>", $txt); all it does is show the address but its not clickable. Can anyone help please Regards Gubbins Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 10, 2009 Share Posted April 10, 2009 $txt = str_replace("(.)*?", "<a href="$1">$1</a>", $txt); Quote Link to comment Share on other sites More sharing options...
Gubbins Posted April 10, 2009 Author Share Posted April 10, 2009 $txt = str_replace("(.)*?", "<a href="$1">$1</a>", $txt); Thank you but when i tried i got this error:- Parse error: syntax error, unexpected '$' in Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 10, 2009 Share Posted April 10, 2009 my bad... try this <?php $txt = preg_replace('/[url](.)*?[/url]', '<a href="$1">$1</a>', $txt); ?> Quote Link to comment Share on other sites More sharing options...
Gubbins Posted April 10, 2009 Author Share Posted April 10, 2009 my bad... try this <?php $txt = preg_replace('/[url](.)*?[/url]', '<a href="$1">$1</a>', $txt); ?> Thanks again but now i have a very different error that does not show the url link:- Warning: preg_replace() [function.preg-replace]: Unknown modifier 'r' in ...... Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 10, 2009 Share Posted April 10, 2009 me again - must slow down today... $txt = preg_replace('/\[url\](.)*?\[\/url\]/', '<a href="$1">$1</a>', $txt); Quote Link to comment Share on other sites More sharing options...
Gubbins Posted April 10, 2009 Author Share Posted April 10, 2009 me again - must slow down today... $txt = preg_replace('/\[url\](.)*?\[\/url\]/', '<a href="$1">$1</a>', $txt); Thanks again, Well i think we are almost there, i now have the last letter of the url showing so if it was www.google.com the m of the com would be showing and i can click on it. but when you hover your mouse over the url the address shown at the bottom is www.yoursite.com/forum/m. What do you think it could be? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 10, 2009 Share Posted April 10, 2009 lol my regex crapness once more!!!! $txt = preg_replace('/\[url\](.*)?\[\/url\]/', '<a href="$1">$1</a>', $txt); see if that works - i'm not on form today - sorry. Quote Link to comment Share on other sites More sharing options...
Gubbins Posted April 10, 2009 Author Share Posted April 10, 2009 lol my regex crapness once more!!!! $txt = preg_replace('/\[url\](.*)?\[\/url\]/', '<a href="$1">$1</a>', $txt); see if that works - i'm not on form today - sorry. That worked a treat THANK YOU. Is there now away i can get it to open in a new window outside of my forum? Quote Link to comment Share on other sites More sharing options...
Gubbins Posted April 10, 2009 Author Share Posted April 10, 2009 I am guessing its something like:- onclick="window.open(this.href, '_blank', 'width=500,height=700,scrollbars=yes,resizable=no,status=no,screenx=5,screeny=5');return false;" onkeypress="this.onclick()" But how i incorporate that into the url bb code god knows lol 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.