debug.rst 661B

12345678910111213141516171819202122232425262728293031
  1. The Debug Extension
  2. ===================
  3. .. caution::
  4. This extension is deprecated as of Twig 1.5. Use the Twig built-in `dump`_
  5. function instead.
  6. The ``debug`` extension provides a ``debug`` tag that can be used to
  7. output the content of the current context:
  8. .. code-block:: jinja
  9. {% debug %}
  10. This is really useful when a template does not work as expected. You can also
  11. output a specific variable or an expression:
  12. .. code-block:: jinja
  13. {% debug items %}
  14. {% debug post.body %}
  15. .. caution::
  16. The ``debug`` tag only works when the ``debug`` environment option is set
  17. to ``true``.
  18. .. _`dump`: http://twig.sensiolabs.org/dump