Permalink
Browse files

minor #4220 Added a note about the side effects of enabling both PHP …

…and Twig (javiereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

Added a note about the side effects of enabling both PHP and Twig

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes
| Applies to    | 2.3+
| Fixed tickets | #3293

Commits
-------

fbbabb1 Reworded the explanation about the limitation of enablin PHP templates
5e47417 Improved the explanation thanks to @stof comments
3828162 Added a note about the side effects of enabling both PHP and Twig
  • Loading branch information...
weaverryan committed Sep 16, 2014
2 parents 46fcb67 + fbbabb1 commit 025f02e7917473cc9a885b41de1fe9ca945044b8
Showing with 27 additions and 0 deletions.
  1. +27 −0 cookbook/templating/PHP.rst
@@ -77,6 +77,33 @@ shortcut to render the default ``AcmeHelloBundle:Hello:index.html.php`` template
return array('name' => $name);
}
.. caution::
Enabling the ``php`` and ``twig`` template engines simultaneously is
allowed, but it will produce an undesirable side effect in your application:
the ``@`` notation for Twig namespaces will no longer be supported for the
``render()`` method::
public function indexAction()
{
// ...
// namespaced templates will no longer work in controllers
$this->render('@Acme/Default/index.html.twig');
// you must use the traditional template notation
$this->render('AcmeBundle:Default:index.html.twig');
}
.. code-block:: jinja
{# inside a Twig template, namespaced templates work as expected #}
{{ include('@Acme/Default/index.html.twig') }}
{# traditional template notation will also work #}
{{ include('AcmeBundle:Default:index.html.twig') }}
.. index::
single: Templating; Layout
single: Layout

0 comments on commit 025f02e

Please sign in to comment.