[PHPTAL] Template lastModified time

Kornel Lesiński kornel at aardvarkmedia.co.uk
Mon Nov 17 11:09:36 CET 2008


On 16-11-2008 at 13:01:31 Maciej Łebkowski <m.lebkowski at gmail.com> wrote:

> I am doing some content negotiation in my application. In particular,
> i`m settign LastModified, ETag, etc headers, and checking if content
> is modified (and returning 304 response if its not).
>
> Now I have:
>     $LastModified = isset($data['LastModified']) ? $data['LastModified']  
> : null;
>
> But I didn`t take into account any template changes. Is there
> a way to get the maximun filemtime() of all used templates?

There's no method for it, but it's easy to add it. In PHPTAL class add:

function getLastModifiedTime()
{
   return $this->_source->getLastModifiedTime();
}

This will give time of main template. If you want time for all templates,  
you'll need to change executeMacro() or setConfigurationFrom() methods.

-- 
regards, Kornel



More information about the PHPTAL mailing list