01-13-2008, 11:44 AM
|
#5 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
|
Quote:
Originally Posted by RobertK
Aha, you've stumbled on the old switcheroo! What do I mean? Well, process [ code ] bbCode first and replace it with a {codeblock_#}, and push the actual code inside the tags to an array with an index of "codeblock_#". To do this you'll have to do a preg_replace with a callback and return the string based off a global variable you initialize to zero for each post. Then at the end use a standard call to:
PHP Code:
return str_replace(array_keys($codeblocks), array_values($codeblocks), $post);
And tada! No smilies, no HTML, and no wonkiness in your code! 
|
You should wrap that into a function. bbCode(); :]
|
|
|
|