Skip to content

[Cookbook][Templating] Use best practice to put templates in app/ dir #5114

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 1 commit into from
Mar 29, 2015
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
14 changes: 7 additions & 7 deletions cookbook/templating/render_without_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ a simple template that doesn't need any data passed into it, you can avoid
creating the controller entirely, by using the built-in ``FrameworkBundle:Template:template``
controller.

For example, suppose you want to render a ``AppBundle:Static:privacy.html.twig``
For example, suppose you want to render a ``static/privacy.html.twig``
template, which doesn't require that any variables are passed to it. You
can do this without creating a controller:

Expand All @@ -22,7 +22,7 @@ can do this without creating a controller:
path: /privacy
defaults:
_controller: FrameworkBundle:Template:template
template: 'AppBundle:Static:privacy.html.twig'
template: static/privacy.html.twig

.. code-block:: xml

Expand All @@ -34,7 +34,7 @@ can do this without creating a controller:

<route id="acme_privacy" path="/privacy">
<default key="_controller">FrameworkBundle:Template:template</default>
<default key="template">AppBundle:Static:privacy.html.twig</default>
<default key="template">static/privacy.html.twig</default>
</route>
</routes>

Expand All @@ -46,7 +46,7 @@ can do this without creating a controller:
$collection = new RouteCollection();
$collection->add('acme_privacy', new Route('/privacy', array(
'_controller' => 'FrameworkBundle:Template:template',
'template' => 'AppBundle:Static:privacy.html.twig',
'template' => 'static/privacy.html.twig',
)));

return $collection;
Expand Down Expand Up @@ -93,7 +93,7 @@ other variables in your route, you can control exactly how your page is cached:
path: /privacy
defaults:
_controller: FrameworkBundle:Template:template
template: 'AppBundle:Static:privacy.html.twig'
template: 'static/privacy.html.twig'
maxAge: 86400
sharedAge: 86400

Expand All @@ -107,7 +107,7 @@ other variables in your route, you can control exactly how your page is cached:

<route id="acme_privacy" path="/privacy">
<default key="_controller">FrameworkBundle:Template:template</default>
<default key="template">AppBundle:Static:privacy.html.twig</default>
<default key="template">static/privacy.html.twig</default>
<default key="maxAge">86400</default>
<default key="sharedAge">86400</default>
</route>
Expand All @@ -121,7 +121,7 @@ other variables in your route, you can control exactly how your page is cached:
$collection = new RouteCollection();
$collection->add('acme_privacy', new Route('/privacy', array(
'_controller' => 'FrameworkBundle:Template:template',
'template' => 'AppBundle:Static:privacy.html.twig',
'template' => 'static/privacy.html.twig',
'maxAge' => 86400,
'sharedAge' => 86400,
)));
Expand Down