Hide a snippet on live server

Hi,

Is it possible to show a snippet on localhost and hide it on live server?
I know it is possible in the content folder with c::set('content.file.ignore',array('somefolder')); in config.php and config.localhost.php files but don’t know how to with a snippet file.
Thank you.

One way is to use a custom config setting, e.g.

c::set('snippet.show', true); // config.localhost.php

And then query your option in your template:

if(c::get('snippet.show')) {
  snippet('mylocalsnippet');
}
2 Likes

Thanks Texnine, effective as usual.