Skip to content

Commit 2a40a3a

Browse files
saro0hweaverryan
authored andcommitted
Simplified reference to the cookbook
1 parent 4d0bdbc commit 2a40a3a

File tree

1 file changed

+7
-44
lines changed

1 file changed

+7
-44
lines changed

book/controller.rst

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -335,52 +335,15 @@ working with forms, for example::
335335
Creating Static Pages
336336
---------------------
337337

338-
.. versionadded:: 2.2
339-
The ``FrameworkBundle:Template:template`` internal controller is new in
340-
Symfony 2.2.
341-
342-
Basically, a static page is just a route that maps a static template. Below is
343-
an example:
344-
345-
.. configuration-block::
346-
347-
.. code-block:: yaml
348-
349-
about:
350-
path: /about.html
351-
defaults:
352-
_controller: FrameworkBundle:Template:template
353-
template: 'AcmeBundle:Static:about.html.twig'
354-
355-
.. code-block:: xml
338+
You can create a static page without creating any controller. Using only the
339+
routing file, you just have to indicate the "FrameworkBundle:Template:template"
340+
as the controller and link the template file, with its logical path.
356341

357-
<?xml version="1.0" encoding="UTF-8" ?>
358-
359-
<routes xmlns="http://symfony.com/schema/routing"
360-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
361-
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
362-
363-
<route id="about" path="/about.html">
364-
<default key="_controller">FrameworkBundle:Template:template</default>
365-
<default key="template">AcmeBundle:Static:about.html.twig</default>
366-
</route>
367-
</routes>
368-
369-
.. code-block:: php
370-
371-
use Symfony\Component\Routing\RouteCollection;
372-
use Symfony\Component\Routing\Route;
373-
374-
$collection = new RouteCollection();
375-
$collection->add('about', new Route('/about.html', array(
376-
'_controller' => 'FrameworkBundle:Template:template',
377-
'template' => 'AcmeBundle:Static:about.html.twig',
378-
)));
379-
380-
return $collection;
342+
.. versionadded:: 2.2
343+
The ability to cache templates rendered via ``FrameworkBundle:Template:template``
344+
is new in Symfony 2.2.
381345

382-
You can also add some caching options to your static page, see
383-
:doc:`cookbook/templating/render_without_controller`.
346+
Use it ! See :doc:`cookbook/templating/render_without_controller`.
384347

385348
The Base Controller Class
386349
-------------------------

0 commit comments

Comments
 (0)