[Templates] Two issues - Processing problem and caching problem (bug?)
Evan Kaufman
evan.kaufman@gmail.com
Wed, 12 Jul 2006 12:07:58 -0500
Josh Rosenbaum wrote:
> > # unless a Template object already exists, create new
> > $TT ||= Template->new({
> > INCLUDE_PATH => $ENV{'DOCUMENT_ROOT'},
> > ABSOLUTE => 1,
> > EVAL_PERL => 1,
> > LOAD_PERL => 1
> > });
>
> Ok, for the above code, remember that on each request if $ENV{'DOCUMENT_ROOT'}
> changes, it will not be changed in $TT since it already exists. I'm not sure
>$ENV{'DOCUMENT_ROOT'} will ever change, though, so this may not be an
issue. If it
> did, then your paths would be screwed up, and you may access a Template elsewhere.
> You might also want to check that the path is what you think it is. You might also want
> to check that $request->filename() goes to where you think it will go. It seems like you
> are loading another file to me.
DOCUMENT_ROOT is set in the apache config file, so once apache starts,
(i think) it should never change until apache is shutdown/restarted.
And because of the way I'm grabbing the filename from the requests,
it'll actually be using absolute paths 99% of the time.
I'm sure it's finding the correct file because its serving sort of a
"mangled" version of that file. And, if I modify the template file,
the "mangled" version in my browser changes the next time its
requested. For instance, I've changed the contents to:
<html>
<body>Testing 1 2 3...</body>
</html>
and i'm getting back:
<hml><bdy>Ti13</bdy></hml>
> I think this mkdir syntax should be fine. Make sure your permissions are set correctly
> on /home/test/cache so that whatever user TT is running as can create directories and
> such. Maybe just chmod the dir to 777 to test.
YES! Caching is working now, thanks!
--
Life is good when the most you have to worry
about is whether or not you're wearing pants.