5

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.

10

Solution:

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

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.