I am working on a little script & i want to save space on my server so I was wondering how can i make it so that when it gets the content off the mysql db it will change it from [url]http://google.com/[/url] HTML: to <a href="http://google.com">http://google.com</a> HTML:
you can do it with regular expressions or explode+str_replace if u cannot handle and have $$ for this contact me via pm
function bbcode($content) { $content = preg_replace(â€@\[b\](.+?)\[\/b\]@iâ€, “<b>$1</b>â€, $content); $content = preg_replace(â€@\[i\](.+?)\[\/i\]@iâ€, “<i>$1</i>â€, $content); $content = preg_replace(â€@\[u\](.+?)\[\/u\]@iâ€, “<u>$1</u>â€, $content); $content = preg_replace(â€@\[img\](.+?)\[\/img\]@iâ€, “<img src=\â€$1\†alt=\â€\†/>â€, $content); $content = preg_replace(â€@\[url\](.+?)\[\/url\]@iâ€, “<a href=\â€$1\â€>[Link]</a>â€, $content); $content = preg_replace(â€@\[url=(.+?)\](.+?)\[\/url\]@iâ€, “<a href=\â€$1\â€>$2</a>â€, $content); $content = str_replace(â€\nâ€, ‘<br />’, $content); $content = preg_replace(â€@\[code\](.+?)\[\/code\]@i", "<span class=\"box\">$1</span>", $content); return($content); } PHP: You can go to http://assasiner.wordpress.com/2006/11/23/bbcode-and-regex/ for more information.