admirau:

class MyTemplateFramework extends PHPTAL {
    private $default_macro_file;
    public function setDefaultFile($default_macro_file){
       $this->default_macro_file;
    }

    public function executeMacro($path){
          if (preg_match('/^(.*?)\/([a-z0-9_]*)$/i', $path, $m)){
                list(,$file,$macroName) = $m;
                if (!is_file($file) && strlen($this->default_macro_file)>0){
                    $path = $this->default_macro_file.'/$macroName';
                }
          }
          parent::executeMacro($path);
    }
}
            
Won't work for you?  Or do you really want it in PHPTAL?

admirau wrote:
> Hello,
>
> It would be very helpful to have something like default macro file.
> I know, that people asked for this feature before.
>
> For example: when only name of the macro is specified,
> and this macro is not found in current file,
> look for this macro in default template file.
>
> $tpl->setDefaultMacroFile('/really/very/long/path/filename.zpt');
>
>


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

Reply via email to