On 26-01-2009 at 19:53:39 Levi Stanley <l...@eneservices.com> wrote:

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?

This works only for external macros. I've just committed improved exception 
handling that allows fallback for local macro names:

class MyTemplateFramework extends PHPTAL {
        public function executeMacro($path)
        {
                try
                {
                        parent::executeMacro($path);
} catch(PHPTAL_MacroMissingException $e)
                {
                        
parent::executeMacro($this->default_macro_file.'/'.$path);
                }
        }
}

--
regards, Kornel



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

Reply via email to