I have a problem with my current bbcode system.
When I nest a code with the same code, it won’t work.
Example:
{quote} {quote} Bla bla bla {/quote} bla bla {/quote}
This will turn out like this:
[quote]
{quote}Bla bla bla
{/quote}
The function I use
[code=php]
function tags_format ($str) {
// Search for tags
$search = array(
‘/[quote](.*?)[/quote]/is’,
‘/[quote=(.*?)](.*?)[/quote]/is’
);
// Replace the tags
$replace = array(
‘<blockquote><h4>Quote:</h4>$1</blockquote>’,
‘<blockquote><h4>$1 wrote:</h4>$2</blockquote>’
);
// Return the string with the tags
$str = preg_replace ($search, $replace, $str);
return $str;
}
Any help is greatly appriciated.