Home

Automatically ?flush when in 'dev' mode

Often when doing development work on a website - and particularly the templates - it can be a pain having to remember to add ?flush to the end of the URL to make sure all of your changes have come through.

I'm sure that all of us have had that "d'oh" moment when we have spent too much time wondering why our changes weren't working, only to find a simple flush fixed it.

If you have set up a domain in your set_dev_servers array or added Director::set_environment_type('dev') to your _config.php file then you can also add:

This will flush the template cache on every page load.

NB: This will not regenerate cached images, if you want to do that you will have to add $_GET['flush'] = 1; inside the above conditional statement.

About the Author

Name: Daniel Hensby

Website: http://www.betterbrief.co.uk

Dan runs a website development company called Better Brief. Better Brief specialise in SilverStripe websites and takes an active role in the UK SilverStripe community, attending SS Meetups and even presenting at them.

Comments (6)


  • Thanks for sharing the informations i like it ,it is very usefull,really!and hope your websit is popular more and more!

    Posted by fm transmitter, 01/09/2010 1:25am (6 days ago)

  • Wow this is going to save a lot of time not to mention the pain of having to put flush at the end of the url. Thanks a lot.

    Posted by Shayne, 31/08/2010 4:31pm (6 days ago)

  • Pefect, thanks!

    Posted by Frank, 31/08/2010 4:19pm (6 days ago)

  • Thats really good to know. Having to flush when developing can be really

    Posted by louis vuitton never full, 02/08/2010 5:19am (1 month ago)

  • I believe it works in 2.3 as well.

    Posted by Dan, 19/04/2010 8:16am (5 months ago)

  • Thats really good to know. Having to flush when developing can be really frustrating. Is this in 2.4 only?

    Posted by Matt Clegg, 17/04/2010 4:09pm (5 months ago)

RSS feed for comments on this page RSS feed for all comments

Post your comment