@@ -871,18 +871,20 @@ is by default "web").
871
871
The end result is a page that includes both the ``main.css `` and ``contact.css ``
872
872
stylesheets.
873
873
874
- The `` app `` Global Variable
875
- ---------------------------
874
+ Global Template Variables
875
+ -------------------------
876
876
877
- Symfony2 will set a global template variable ``app `` on every request in
878
- both Twig and PHP template engines by default. The ``app `` variable will
879
- give you access to some application specific variables automatically:
877
+ During each request, Symfony2 will set a global template variable ``app ``
878
+ in both Twig and PHP template engines by default. The ``app `` variable
879
+ is a :class: `<Symfony\\ Bundle\\ FrameworkBundle\\ Templating\\ GlobalVariables> `
880
+ object which will give you access to some application specific variables
881
+ automatically:
880
882
881
883
* ``app.security `` - The security context service.
882
- * ``app.user `` - The current user object. Equivalent to `` app.security.token.user ``.
884
+ * ``app.user `` - The current user object.
883
885
* ``app.request `` - The request object.
884
886
* ``app.session `` - The session object. Equivalent to ``app.request.session ``.
885
- * ``app.environment `` - The current environment (dev, prod, etc)
887
+ * ``app.environment `` - The current environment (dev, prod, etc).
886
888
* ``app.debug `` - True if in debug mode. False otherwise.
887
889
888
890
.. configuration-block ::
@@ -903,6 +905,11 @@ give you access to some application specific variables automatically:
903
905
<p>Application Environment: <?php echo $app->getEnvironment() ?></p>
904
906
<?php endif; ?>
905
907
908
+ .. tip ::
909
+
910
+ You can set your own global template variables. See the cookbook example
911
+ on :doc: `Global Variables</cookbook/templating/global_variables> `.
912
+
906
913
.. index ::
907
914
single: Templating; The templating service
908
915
0 commit comments