On 6 Aug 2010, at 10:35, Bas Kooij wrote:

> Thanks for the reply,
> So if I name the macro customMacro/customMacro the resolver would recognize 
> it? But that makes the second part irrelevant for CustomResolvers right?

Right. If you use path customMacro/customMacro then resolver will get 
"customMacro" as path to resolve. Macro syntax is path/macro, and resolver is 
only for resolving paths, not macros.

If you used macros "path/macro1", "path/macro2", "path/macro3" then your 
resolver would be called only once with path "path".

> Slightly off topic... 
> I really love PHPTal, it has cut development time for implementing templates 
> in half. 
> The only time I get stuck is when I have to insert dynamic templates into my 
> PHPTal template files. This is quite a common occurrence when clients use a 
> content 
> management system to edit pages. I want them to be able to insert some sort 
> of 
> tags in the CMS, ie. [DATE], which I can then replace with PHPTal code, for 
> instance 
> <span tal:content="date | nothing" />. 

This is what prefilters are for:

class DateMagic extends PHPTAL_PreFilter 
  function filter($src) {return str_replace('[DATE]', '<span tal:content="date 
| nothing" />', $src);}

$phptal->addPreFilter(new DateMagic());

regards, Kornel

PHPTAL mailing list

Reply via email to