How can we improve WHMCS?

Share, discuss and vote for what you would like to see added to WHMCS

Option to Disable Template Caching



When changing the templates for pages, it is extremely annoying to have to manually delete the files from templates_c when making small iterative changes. The caching system currently isn't smart enough to generate new files.

There really should be an option to completely disable caching as this makes development take longer.

6 Comments

Login to post a comment.

Add this to your header.tpl and it will disable the cache

[co]
  • {php}
  • //disable in production for v 6+
  • $template->clear_compiled_tpl();
  • {/php}
  • [/co]
    This should be included in the core functionality ... hooks are nice and all but its something that should be included....
    Just use this hook to delete cache on every refresh:

    [co]
  • function deleteCache()
  • {
  • global $templates_compiledir;
  • $cacheFiles = glob($templates_compiledir.'*');
  • foreach($cacheFiles as $file){
  • if(is_file($file) && strpos($file,'index.php') == false)
  • unlink($file); // delete file
  • }
  • }
  • add_hook("ClientAreaPage",1,"deleteCache","");
  • [/co]
    Alan Tisdale wrote:I give up! I can't work with WHMCS when there's no option to disable the cache. Who can develop like this? It makes the whole development process impossible.
    It does make the development time a bit longer. Especially if you forget to delete the cache, and are pulling your hair out as to why a change, within your code, didn't have any effect. I typically have the templates_c folder loaded in WinSCP, and clear the files within it, before I test my code changes.
    I give up! I can't work with WHMCS when there's no option to disable the cache. Who can develop like this? It makes the whole development process impossible.
    This needs to be an option for doing development. The ability to turn off template caching, while doing development within templates, would tremedously help productivity.