Hello,
I've got a little question. I am writing a page where I would like to
parse my own invented HTML-looking tags (but want to keep the real HTML
tags intact). I use a buffer for the output, and just before the end use
ob_get_contents() to get the whole buffer which I want to check for
those tags.
(Something like:
$tag->content = ob_get_contents();
$output = $tag->interpret();
ob_end_clean();
echo "$output";
)
Now my question is, what is the fastest way to search and replace
through this file, whereby the interpretation of the tag can be somewhat
complicated?
I first just had a loop running character by character through this
text, looking for tags, but that is obviously way too slow.
Now I have something like:
preg_replace_callback ("/<(.+)>/", array($this, 'tag_callback'),
$this->content);
But then I don't know how to interpret different tags differently. Any
suggestions?
(A tag looks like: <CANTR REPLACE NAME=text> where then the whole tag
has to be replaced by something called 'text' that has to be looked up
in a table. So, <CANTR REPLACE NAME=text> has to be replaced with
something else than <CANTR REPLACE NAME=main> - well, you get the idea.)
Thanks in advance for any help!
Jos
--
Jos Elkink
Game Administration Council
Cantr II http://www.cantr.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php