Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 16, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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