Hi,

I'm very glad with using phptal:cache, especially with "per " parameter.
But now, I want to achieve something like that:

I have following template:

<div id="word" phptal:cache="1h per url">
            Word of the day is: <span tal:content="word">word of the
day</span>
</div>

Now I do:

{{
// :my php code: to retrieve word which takes very long to execute
// returns $word
$tpl=new PHPTAL('test.html');
$tpl->word = $word;
}}

I'd like to execute {{...}} only when cache is not fetched, else just
display cached HTML.

I know I have to write trigger like that:
class myTrigger implements PHPTAL_Trigger
        {
            public function start($phptalid, $tpl) {
                $cache_not_fetched = ...
                if ($cache_not_fetched) {
                    {{...}}
                } else {
                    // display cached html
                }
                return self::PROCEED;
            }

            public function end($phptalid, $tpl) {
                return;
            }
        }

But how to detect if cache is fetched by phptal:cache?
Shall I rewrite everything from PHPTAL_Php_Attribute_PHPTAL_Cache to have
"per"?

Where I can find PHPTAL_Cache Interface which is mentioned in the manual?

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

Reply via email to