A similar question was answered before, but I was wonder how I might be able to return the same query from within a plugin (php)?

Convert this:

{{ craft.config.environmentVariables.baseUrl }}

To something like this: (not correct)

return craft()->config->get('environmentVariables.baseUrl');

What would be the correct syntax?

Thanks, Mark.

1 Answer 1



return craft()->config->get('environmentVariables')['baseUrl'];
  • For older versions of PHP: var enVar = craft()->config->get('environmentVariables'); return enVar['baseUrl']; Commented Jun 18, 2015 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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