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 2 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
26 changes: 26 additions & 0 deletions cookbook/templating/PHP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,32 @@ 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowed, but [...]

Template namespaces will no longer work except inside Twig templates::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be very vague for most users. I prefer something like "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