Jump to content

PHP coding issue


Guest Toshiba23

Recommended Posts

Guest Toshiba23

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.