I'm trying to set up caching and have it disabled for my local environment using {% cache unless craft.config.devMode %}
. This works fine on non-local environments, but on my local environment I'm getting the error Method "devMode" for object "Craft\ConfigVariable" does not exist
. Even though it does, this is my config file:
return array(
'*' => array(
'addTrailingSlashesToUrls' => true,
'omitScriptNameInUrls' => true,
'enableCsrfProtection' => true,
'cpTrigger' => 'example-admin',
'siteUrl' => (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER['HTTP_HOST'],
'environmentVariables' => array(
'basePath' => $_SERVER['DOCUMENT_ROOT'] . '/data/uploads/',
'baseURL' => (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://" . $_SERVER['HTTP_HOST'] . '/data/uploads/',
)
),
'.local' => array(
'devMode' => true
)
);
If I {{ dump(craft.config.devMode) }}
I get bool(true)
so it is being set, it's just when being used in the cache conditional.
{% if craft.config.devMode %}Check DevMode{% endif %}
?{% cache unless craft.config.devMode %}
it worked.'cache' => true
? Then you can set it independently from dev mode.