4

I'm using Craft 2.6.2776. According to the templating docs, Craft extends the built-in Twig templating functions, which it links to. Among those functions is dump().

Here's the relevant part of my template:

{% dump(craft.request.getURL) %}

When I refresh the page, I get the error Unknown "dump" tag..

It seems like dump should be supported, according to the docs. What's going on?

Edit

I'm using VirtualHostX to run my PHP server, and the URL is xxx.dev. According to my general.php file, I am in dev mode:

  '.dev' => array(
    'enableTemplateCaching' => false,
    'siteUrl' => 'http://xxx.dev',
    'environmentVariables' => array(
      'baseUrl' => 'http://xxx.dev'
    ),
    'devMode' => true
  ),
6

The dump tag is not a logic operator (e.g., no percent sign) — it should use the simple field brackets. As well, the proper format is either .url or .getUrl()

{{ dump(craft.request.url) }}
2
  • 1
    Of course I overlook the obvious.
    – Brad Bell
    Apr 4 '16 at 17:44
  • ;) I've done the same way too many times. Apr 4 '16 at 17:45
5

Twig's dump tag is only available when Craft's devMode is enabled.

5
  • devMode needs to be in the '.dev' array block. Or if you want it globally, it needs to be in the '*' key. See craftcms.com/docs/multi-environment-configs for more info.
    – Brad Bell
    Apr 4 '16 at 17:41
  • It seems to be in the .dev array block; see above. Apr 4 '16 at 17:42
  • Do you have a '*' block? Required for multi-environment configs.
    – Brad Bell
    Apr 4 '16 at 17:43
  • Yes, there's a '*' block. devMode isn't in there because I don't want it globally. Apr 4 '16 at 17:58
  • Just ignore me... Patrick's answer is correct.
    – Brad Bell
    Apr 4 '16 at 17:59

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.