Skip to content

Commit

Permalink
Adding clarification of the point of using the "app" Twig variable in…
Browse files Browse the repository at this point in the history
… our project

This is after some user had issues posted via comments:
https://knpuniversity.com/screencast/symfony2-ep1/mind-tricks#comment-983252106

This shouldn't relate to any CSS issues, so I'm not sure what's going on with that, but hopefully this will help
  • Loading branch information
weaverryan committed Sep 28, 2013
1 parent fef9456 commit 4471b58
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions knpu/mind-tricks.rst
Expand Up @@ -166,12 +166,25 @@ User object, and the session:

.. code-block:: html+jinja

{{ app.session.get('some_session_key') }}
{{ app.request.host }}
{# src/Yoda/EventBundle/Resources/views/Event/index.html.twig #}
{# ... #}

{% block body %}
{{ app.session.get('some_session_key') }}
{{ app.request.host }}

{# ... #}
{% endblock %}

Actually, it's an object called `GlobalVariables`_, which you can check out
yourself. So when you need one of these things, remember that app variable!

.. tip::

You can remove this code after trying it out - it's just an example of
how you can access the request and session data - it doesn't add anything
real to our project.

The block Twig Function
-----------------------

Expand Down

0 comments on commit 4471b58

Please sign in to comment.