1

I am trying to get the value of an environment variable (defined in the general.php config file) in the routes.php config file. Is it possible or not? I tried $environmentVariables = craft()->config->get('environmentVariables')['myVariable'] but that throws an error: Call to undefined function craft().

1

I think you'll just need to do something like this in your routes.php file:

$general = require __DIR__.'/general.php';

return array(
    'foo' => $general['environmentVariables']['bar'],
);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.