Caching problem

Alain Williams <[email protected]> Tue, 2 Aug 2005 20:07:34 +0100
Newsgroups gmane.comp.php.smarty.devel
Organization Parliament Hill Computers Ltd
Message-ID <[email protected]>
I have a caching problem.

Code:
	$tpl =& new Smarty;
	$tpl->template_dir = '.';           // Where the template files live
	// Smarty 'compiles' the .tpl and creates a .php script to generate the html
	// Next time smarty will use the .php without recompilation if the .tpl has not changed
	$tpl->compile_dir  = 'cache';
	$tpl->caching = 1;
	$tpl->cache_lifetime = 86400;       // Regenerate cache once/day

	....

	// parse and display the template
	$tpl->display('QfSmarty.tpl');

In cache/ this generates 

-rw-r--r--  1 apache apache 4257 Aug  2 19:36 %%E0^E08^E08C3785%%QfSmarty.tpl
-rw-r--r--  1 apache apache 4130 Aug  2 19:36 %%E0^E08^E08C3785%%QfSmarty.tpl.php

The generated .php file is fine and if run again (eg if I just remove *.tpl),
but the .tpl file has everything substituted in ... it is html (with some junk
at the top).

The trouble is that next time it is run the php will generate different output
(which the compiled .php will correctly generate) - but the compiled php will not
be looked at because there exists a .tpl. What I want is the ability to say:

Please cache the .php, but don't cache the .tpl

Is there a way of asking this that I have overlooked ?

TIA

-- 
Alain Williams
Parliament Hill Computers Ltd.
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/

#include <std_disclaimer.h>
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFC78R2ikkW5JBhACYRAkqyAJ0eEdShJ7qJcLCpzVrbgpAFdD6xxwCgk9YB
C3OQ9oBDxEDxfnQf056EUzQ=
=GWhb
-----END PGP SIGNATURE-----