How to clear Smarty's Cache

user470760 picture user470760 · Mar 22, 2011 · Viewed 19.7k times · Source

The original owner of our company had the website designed using Smartys. I have updated the product page, but even after deleting the temporary file from "templates_c" which I thought was the cache file, the updated products page will not show up at all, everything still looks exactly as it did previously.

How can I clear the cache on Smartys so my modified page will be viewable?

Answer

Michael Berkowski picture Michael Berkowski · Mar 22, 2011

Smarty uses a compile directory and a separate cache directory. templates_c is probably the compile directory. The cache is specified in $smarty->cache_dir. That's the one you need to empty.

In PHP with Smarty version 2, you can execute the function clear_all_cache()

$smarty->clear_all_cache();

If you are using Smarty version 3, the command is clearAllCache()

$smarty->clearAllCache();

To find out the cache directory:

echo $smarty->cache_dir;