Welcome Guest, Not a member yet? Register   Sign In
URGENT: I need to turn off Smarty caching
#9

[eluser]Phil Sturgeon[/eluser]
You don't want to turn off caching everywhere. I would not agree with Google on this one at all. HTML is generated from PHP based on the provided data and conditions. If the data and conditions do not change often, the HTML does not change often.

If you are handling crucial financial data that changes every 2 minutes and contains stock prices or something, then yes, caching is a bad way to go. If you are showing news articles on a high-traffic blog then I'd be tempted to throw that cache up to 30-60 minutes!

Anyway, how you approach this depends on how you have integrated Smarty. You are probably doing something like this:

Code:
$smarty = new Smarty();

// or

$this->load->library('smarty');

To turn off caching you would do this:

Code:
$smarty->caching = 0;

// or

$this->smarty->caching = 0;

You can turn it off on a per-page or per-method basis. Or by calling this multiple times within a method (between the various smarty includes) you can do partial caching which is probably more useful.

Remember: Smarty will use the _c folders for cache AND compile (unless told to do otherwise). The compiled files are not cached and even though they exist and will exist for a while, they are not used as cached content. It is simply how Smarty does its thing.

The difference: .tpl.php = compiled, .tpl = cached


Messages In This Thread
URGENT: I need to turn off Smarty caching - by El Forum - 07-07-2009, 06:58 PM
URGENT: I need to turn off Smarty caching - by El Forum - 07-07-2009, 07:04 PM
URGENT: I need to turn off Smarty caching - by El Forum - 07-07-2009, 07:07 PM
URGENT: I need to turn off Smarty caching - by El Forum - 07-07-2009, 07:51 PM
URGENT: I need to turn off Smarty caching - by El Forum - 07-07-2009, 07:55 PM
URGENT: I need to turn off Smarty caching - by El Forum - 07-07-2009, 08:08 PM
URGENT: I need to turn off Smarty caching - by El Forum - 07-08-2009, 12:54 AM
URGENT: I need to turn off Smarty caching - by El Forum - 07-08-2009, 01:03 AM
URGENT: I need to turn off Smarty caching - by El Forum - 07-08-2009, 02:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB