Guest Toshiba23 Posted July 6, 2006 Share Posted July 6, 2006 Hey guys, I have a slight issue here, I have a function for bbcode that I have made... function bbcode($txt){ $txt = htmlspecialchars($txt); $txt = preg_replace_callback('#\[php\](.+?)\[/php\]#msi',create_function('$matches', 'return highlight_string($matches[1], true);'), $txt); $txt = preg_replace('#\[b\](.+?)\[/b\]#msi', '\\1', $txt); $txt = preg_replace('#\[i\](.+?)\[/i\]#msi', '\\1', $txt); $txt = preg_replace('#\[u\](.+?)\[/u\]#msi', '\\1', $txt); $txt = preg_replace('#\[url=(.+?)\](.+?)\[/url\]#msi','\\2', $txt); $txt = preg_replace('#\[url\](.+?)\[/url\]#msi','\\1', $txt); $txt = preg_replace('#\[img](.+?)\[/img\]#msi','',$txt); $txt = preg_replace('#\[quote name=(.+?)\](.+?)\[/quote\]#msi','</pre><table width="75%" align="center" cellpadding="2" cellspacing="1">Quoting: \\1\\2</table>',$txt);<br><br><br><br>$txt = nl2br($txt);<br><br><br><br> return $txt;<br><br><br><br>}<b That works just fine, but now for the issue. In phpBB, if you just type a url, it'll transform it for you http://www.clan-forge.net/ Such as that (Thats my website btw) and also bbcode ( tags, things like that) But it does both, I cannt get my function to do both without it contradicting the other... suggestions? Link to comment Share on other sites More sharing options...
x76 Posted July 7, 2006 Share Posted July 7, 2006 you can search the string for url if its found parse it, if its not found search for just http:// and parse the string until the trailing space Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now