Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e47417

Browse files
committed
Improved the explanation thanks to@stof comments
1 parent3828162 commit5e47417

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎cookbook/templating/PHP.rst‎

Lines changed: 12 additions & 4 deletions
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 animportant side effect in your application:
84-
template namespaces will no longer work::
83+
allowed but it will produce anundesirable 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 thetraditional 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)

[8]ページ先頭

©2009-2025 Movatter.jp