On Mon, 16 Apr 2012 12:09:39 +0100, Robert Goldsmith <rgoldsm...@names.co.uk> wrote:

This all looks pretty reasonable but now I'm looking at how these namespace classes are initiated and I'm looking at class PHPTAL_Dom_Defs. The comments in this class suggest I can create a subclass and use it to register additional namespaces but then the class is setup as a singleton and I can't see how I'd be able to replace it.

Assuming that all I need to do is call PHPTAL_Dom_Defs's registerNamespace() method to register my new namespace then could someone possibly suggest a good time to do this? Normally, the namespaces are registered in the constructor which is called the first time PHPTAL_Dom_Defs is used. I guess I'd need to find a sensible point guaranteed to be before the first use of this class and call it myself to register the new namespace.

The singleton isn't most elegant indeed.

I think you can safely execute PHPTAL_Dom_Defs::getInstance()->registerNamespace() at any time before PHPTAL class compiles the template.

regards, Kornel Lesiński

PHPTAL mailing list

Reply via email to