Sigbert Klinke asks about <sample>:
is called is there a way to get the tag name "sample" itself inside [a tag extension]?
I am pretty sure the answer is no. I worked around it by defining my callbacks dynamically, one per tag.
Suppose you are writing 3 tags named <A>, <B>, and <C>. You can dynamically create a callback function for each one, passing the tag name to it, something like this:
public static function initTags(Parser &$parser) { foreach (array('A', 'B', 'C') as $tagName) { $callback = function($argv) use ($tagName, $parser) { return Tags::processTag($tagName, $argv, $parser); }; $parser->setHook($tagName, $callback); } return true; }
Now the function processTag() knows the tag name, and you can write it to do whatever you want.
DanB