On 30-06-2010 at 17:42:17 Bas <kooy...@hotmail.com> wrote:

It doesn't work without the cache attribute, in fact that was the reason I tried using the cache attribute. I tried putting a span inside the tal:block with the define macro and set the cache on the span, but that didn't make a difference.

It looks like the caching occurs in the main template file. If I change the 'use macro' name to content2 I get the error message:

'PHPTAL_MacroMissingException' with message 'Macro 'content2' is not defined in article_69.

Even if I change the resolve function to output a macro called content2.

I've added test for it (in SVN tests/SourceTest.php) and it works for me.

I've found one gotcha - if you use PHPTAL_StringSource, then $realpath constructor argument should be either path of file on disk, or change whenever source changes.

This is a bit confusing, so I've made that argument optional (in SVN version) -- don't specify it, and caching will work.

Workaround for v1.2.1:

new PHPTAL_StringSource($source, PHPTAL_StringSource::NO_PATH_PREFIX.md5($source));

regards, Kornel

PHPTAL mailing list

Reply via email to