Hi all,

I'm looking to add a custom namespace to allow me to do some additional 
processing on a template. As the processing is something I want to do globally 
and at template compile time the custom namespace seems like a good option and 
there seems to be some support for this.

I've looked at the way the namespace code works and I believe I need to:

* Create a new class that extends the PHPTAL_Namespace_Builtin class
* In the constructor of this class register my attributes and the namespace 
prefix etc.
* Replace the builtin method for createAttributeHandler() so I can load my 
implementation classes from elsewhere.

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.

Robert
----
Robert Goldsmith
rgoldsm...@names.co.uk





_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to