Skip to content

Commit 216d086

Browse files
javiereguiluzdaFish
authored and
daFish
committed
Improved the explanation thanks to @stof comments
1 parent 82ae880 commit 216d086

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

cookbook/templating/PHP.rst

+12-4
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,28 @@ shortcut to render the default ``AcmeHelloBundle:Hello:index.html.php`` template
8080
.. caution::
8181

8282
Enabling the ``php`` and ``twig`` template engines simultaneously is
83-
allowed but it will produce an important side effect in your application:
84-
template namespaces will no longer work::
83+
allowed but it will produce an undesirable side effect in your application.
84+
Template namespaces will no longer work except inside Twig templates::
8585

8686
public function indexAction()
8787
{
8888
// ...
8989

90-
// namespaced templates will no longer work
90+
// namespaced templates will no longer work in controllers
9191
$this->render('@Acme/Default/index.html.twig');
9292

93-
// traditional template notation will work
93+
// you must use the traditional template notation
9494
$this->render('AcmeBundle:Default:index.html.twig');
9595
}
9696

97+
.. code-block:: jinja
98+
99+
{# inside a Twig template, namespaced templates work as expected #}
100+
{{ include('@Acme/Default/index.html.twig') }}
101+
102+
{# traditional template notation will also work #}
103+
{{ include('AcmeBundle:Default:index.html.twig') }}
104+
97105
98106
.. index::
99107
single: Templating; Layout

0 commit comments

Comments
 (0)