Skip to content

Commit

Permalink
minor #4220 Added a note about the side effects of enabling both PHP …
Browse files Browse the repository at this point in the history
…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 025f02e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cookbook/templating/PHP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 025f02e

Please sign in to comment.