Commit c51b99bd authored by Igor Wiedler's avatar Igor Wiedler

[docs] adjust usage section of twig

parent 340b6ce2
...@@ -68,11 +68,16 @@ The Twig extension provides a ``twig`` service. ...@@ -68,11 +68,16 @@ The Twig extension provides a ``twig`` service.
This will render a file named ``views/hello.twig``. This will render a file named ``views/hello.twig``.
It also registers the application as a global named .. tip::
``app``. So you can access any services from within your
view. For example to access ``$app['request']->getHost()``,
just put this in your template:
.. code-block:: jinja The TwigExtension also registers the application as a global
named ``app``. So you can access any services from within your
view. For example to access ``$app['request']->getHost()``,
just put this in your template:
.. code-block:: jinja
{{ app.request.host }} {{ app.request.host }}
For more information, check out the `Twig documentation
<http://www.twig-project.org>`_.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment