ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to use clear_caching function

September 27, 2012 11:58am

Subscribe [2]
  • #1 / Sep 27, 2012 11:58am

    Mike Bean

    14 posts

    Hello there,

    I want to put a piece of php in one of my templates that will manually clear all expression engine caches. I’ve found the relevant function in the docs (see below) but I can’t for the life of me make it work. Can you help me?

    Ideally I need a complete code sample that includes everything I need to make this work.

    clear_caching(which [str], sub-directory [str], relationships [bool])
  • #2 / Sep 27, 2012 12:17pm

    Mike Bean

    14 posts

    Typical! After a day of struggling with this, I worked it out as soon as I’d posted here. The answer if you’re interested is:

    <?php $this->EE->functions->clear_caching('all', '', TRUE); ?>
  • #3 / Sep 27, 2012 1:33pm

    Enviromed

    375 posts

    Thank you for solving and then sharing this!

  • #4 / Sep 28, 2012 2:36am

    Kevin Smith

    4784 posts

    Thanks for posting your solution back here, Mike! A word of warning to anyone using PHP in templates to just be aware of potential security implications before enabling PHP in your templates. More about those security concerns can be found here.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases