You need to look into the HTTP 1.1 spec over at the www.w3c.org site.  Check out the 
HTTP response headers section. I believe you
will find information on how to set caching preferences there.

-Stephen

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Vivek Khera
Sent: Wednesday, June 27, 2001 04:54 PM
To: Template Toolkit
Subject: [Templates] mod_perl app which needs non-cache on *some* docs


I have an application that runs just about every page through the same
template object like this inside the defined handler:

    # send headers to the client
    $r->send_http_header('text/html');

    return OK if $r->header_only(); # HEAD request, so skip out early!

    Apache->request($r);        # plugins might need it
    $tt->process($fileName, undef, $r)
      or do { warn $tt->error(); return SERVER_ERROR; };

    return OK;


Now, *some* of the docs need to be not cached, while others can be.
That is, if the user hits the ol' back button, the page is reloaded
from the server not their cache.

Using this in the main template:

  <head>
    <title>[% template.title %]</title>
    <LINK REL="stylesheet" HREF="/style.css" TYPE="text/css" MEDIA="screen">
[% IF template.donotcache +%]
    <META http-equiv="Cache-control" content="no-cache">
    <META http-equiv="Pragma" content="no-cache">
[%+ END %]
  </head>


I get the desired effect in Netscape.  However, Opera and IE5 don't
give a hoot about the no-cache flags.  I even tried adding

    <META http-equiv="Expires" content="[% time2str("%c",1) %]">

where time2str calls Apache::Util::ht_time with those args in the
right order...  netscape still does the right thing, but the others
don't.

Am I just SOL in making these selected pages reload instead of just
redisplayed?

Do I need to rejigger my handler to issue the $r->no_cache(1) call and
buffer the $tt->process output until we know if we need to not be
cached?  Or will IE and Opera just ignore my no-cache anyway?

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates



Reply via email to