Your class can be called whatever you wish and can be either manually required 
before first use or loaded using any available autoloader. You can put it 
wherever you like :)

We work heavily with Zend Framework and so use autoloaders and Symphony has a 
similar system but feel free to keep things simple and require the class 
manually as long as you do so before the point you call 
'PHPTAL_Dom_Defs::getInstance()->registerNamespace(new MyNewNS());'

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


> I've added my own namespace using:
> PHPTAL_Dom_Defs::getInstance()->registerNamespace(new MyNewNS());
> 
> And defined the NS class as:
> /* ************************************
> *
> */ /* ***************************** */
> class MyNewNS extends PHPTAL_Namespace_Builtin
> {
> /* ************************************
> *
> */ /* ***************************** */
>   public function __construct(){
>       parent::__construct('MyNewNS', 'http://ctrlogic.net/tpl/phptal/ns');
>       $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('att', 4));
>   }
> }
> 
> And defined the Attribute class as:
> /* ************************************
> *
> */ /* ***************************** */
> class PHPTAL_Php_Attribute_MyNewNS_att extends PHPTAL_Php_Attribute
> {
> /* ************************************
> *
> */ /* ***************************** */
>   public function before(PHPTAL_Php_CodeWriter $codewriter)
>   {
> $code = <<<code
> Some php code here
> code;
>       $codewriter->pushCode($code);
>   }
> /* ************************************
> *
> */ /* ***************************** */
>   public function after(PHPTAL_Php_CodeWriter $codewriter)
>   {
>   }
> }
> 
> Is there any way not having this attribute class inside the PHPTAL installed 
> repository?
> 
> I want to have it outside the PHPTAL installed repository...
> 
> Would preloading it prevent PHPTAL from searching the class inside its own 
> installed repository?
> 


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

Reply via email to