01-11-2008, 08:27 PM
|
#2 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
|
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! 
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
|
|
|
|