From e43be41b0b919e024311c69a7af20a673c449ba7 Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Sat, 30 Mar 2013 18:28:20 +0100 Subject: [PATCH 1/8] [book] [controller] Added documentation for static pages --- book/controller.rst | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/book/controller.rst b/book/controller.rst index 1f51d5ed4c5..6d1cffbc746 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -332,6 +332,56 @@ working with forms, for example:: .. index:: single: Controller; Base controller class +Creating Static Pages +--------------------- + +.. versionadded:: 2.2 + The ``FrameworkBundle:Template:template`` internal controller is new in + Symfony 2.2. + +Basically, a static page is just a route that maps a static template. Below is +an example: + +.. configuration-block:: + + .. code-block:: yaml + + about: + pattern: /about.html + defaults: + _controller: FrameworkBundle:Template:template + template: 'AcmeBundle:Static:about.html.twig' + + .. code-block:: xml + + + + + + + FrameworkBundle:Template:template + AcmeBundle:Static:about.html.twig + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('acme_privacy', new Route('/about.html', array( + '_controller' => 'FrameworkBundle:Template:template', + 'template' => 'AcmeBundle:Static:about.html.twig', + ))); + + return $collection; + +You can also add some caching options to your static page, see +:doc:`cookbook/templating/render_without_controller`. + The Base Controller Class ------------------------- From 385f2044422bb9cf57aa0189c5b0008d86ea2f4e Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Sat, 30 Mar 2013 18:36:25 +0100 Subject: [PATCH 2/8] [book] [controller] Fixed route name --- book/controller.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 6d1cffbc746..07ae05b3fa1 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -360,7 +360,7 @@ an example: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + FrameworkBundle:Template:template AcmeBundle:Static:about.html.twig @@ -372,7 +372,7 @@ an example: use Symfony\Component\Routing\Route; $collection = new RouteCollection(); - $collection->add('acme_privacy', new Route('/about.html', array( + $collection->add('about', new Route('/about.html', array( '_controller' => 'FrameworkBundle:Template:template', 'template' => 'AcmeBundle:Static:about.html.twig', ))); From 442420a268c2c37b7aa0a74d3564a2f32052a586 Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Sat, 30 Mar 2013 18:51:11 +0100 Subject: [PATCH 3/8] [book] [controller] Fixed path option --- book/controller.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 07ae05b3fa1..6b953ac50db 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -347,7 +347,7 @@ an example: .. code-block:: yaml about: - pattern: /about.html + path: /about.html defaults: _controller: FrameworkBundle:Template:template template: 'AcmeBundle:Static:about.html.twig' @@ -360,7 +360,7 @@ an example: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + FrameworkBundle:Template:template AcmeBundle:Static:about.html.twig From 9a7d71852d956b063c7b6f3e8263924f51de5130 Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Thu, 4 Apr 2013 13:12:55 +0200 Subject: [PATCH 4/8] Simplified reference to the cookbook --- book/controller.rst | 51 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 44 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 6b953ac50db..060dc6dc928 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -335,52 +335,15 @@ working with forms, for example:: Creating Static Pages --------------------- -.. versionadded:: 2.2 - The ``FrameworkBundle:Template:template`` internal controller is new in - Symfony 2.2. - -Basically, a static page is just a route that maps a static template. Below is -an example: - -.. configuration-block:: - - .. code-block:: yaml - - about: - path: /about.html - defaults: - _controller: FrameworkBundle:Template:template - template: 'AcmeBundle:Static:about.html.twig' - - .. code-block:: xml +You can create a static page without creating any controller. Using only the +routing file, you just have to indicate the "FrameworkBundle:Template:template" +as the controller and link the template file, with its logical path. - - - - - - FrameworkBundle:Template:template - AcmeBundle:Static:about.html.twig - - - - .. code-block:: php - - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection = new RouteCollection(); - $collection->add('about', new Route('/about.html', array( - '_controller' => 'FrameworkBundle:Template:template', - 'template' => 'AcmeBundle:Static:about.html.twig', - ))); - - return $collection; +.. versionadded:: 2.2 + The ability to cache templates rendered via ``FrameworkBundle:Template:template`` + is new in Symfony 2.2. -You can also add some caching options to your static page, see -:doc:`cookbook/templating/render_without_controller`. +Use it ! See :doc:`cookbook/templating/render_without_controller`. The Base Controller Class ------------------------- From 1ce1cd098e081c924ae82bb916f012a05c5aa304 Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Thu, 4 Apr 2013 13:43:15 +0200 Subject: [PATCH 5/8] Fixed typo --- book/controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/controller.rst b/book/controller.rst index 060dc6dc928..7a989a6bda6 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -337,7 +337,7 @@ Creating Static Pages You can create a static page without creating any controller. Using only the routing file, you just have to indicate the "FrameworkBundle:Template:template" -as the controller and link the template file, with its logical path. +as the controller and the logical path of your template. .. versionadded:: 2.2 The ability to cache templates rendered via ``FrameworkBundle:Template:template`` From eb6e5ca3659c257a45cf23271ac1f61d6c510dad Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Thu, 4 Apr 2013 22:51:59 +0200 Subject: [PATCH 6/8] Reorganized the paragraph --- book/controller.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 7a989a6bda6..144f0c67094 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -335,14 +335,14 @@ working with forms, for example:: Creating Static Pages --------------------- +.. versionadded:: 2.2 +The ability to cache templates rendered via ``FrameworkBundle:Template:template`` + is new in Symfony 2.2. + You can create a static page without creating any controller. Using only the routing file, you just have to indicate the "FrameworkBundle:Template:template" as the controller and the logical path of your template. -.. versionadded:: 2.2 - The ability to cache templates rendered via ``FrameworkBundle:Template:template`` - is new in Symfony 2.2. - Use it ! See :doc:`cookbook/templating/render_without_controller`. The Base Controller Class From 8b4d0adc796508e5eb9a01b4394ffa5a3ae7afe5 Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Fri, 5 Apr 2013 23:47:43 +0200 Subject: [PATCH 7/8] Fixed typo --- book/controller.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 144f0c67094..40ddb66f6c2 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -336,14 +336,14 @@ Creating Static Pages --------------------- .. versionadded:: 2.2 -The ability to cache templates rendered via ``FrameworkBundle:Template:template`` + The ability to cache templates rendered via ``FrameworkBundle:Template:template`` is new in Symfony 2.2. You can create a static page without creating any controller. Using only the routing file, you just have to indicate the "FrameworkBundle:Template:template" as the controller and the logical path of your template. -Use it ! See :doc:`cookbook/templating/render_without_controller`. +Use it ! See :doc:`/cookbook/templating/render_without_controller`. The Base Controller Class ------------------------- From 00be6b018a8bd85d773ab7f0bf39a6d5631e2ef8 Mon Sep 17 00:00:00 2001 From: Sarah Khalil Date: Sat, 6 Apr 2013 10:56:46 +0200 Subject: [PATCH 8/8] Removed new verision added section --- book/controller.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 40ddb66f6c2..c588cd5b4c2 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -335,10 +335,6 @@ working with forms, for example:: Creating Static Pages --------------------- -.. versionadded:: 2.2 - The ability to cache templates rendered via ``FrameworkBundle:Template:template`` - is new in Symfony 2.2. - You can create a static page without creating any controller. Using only the routing file, you just have to indicate the "FrameworkBundle:Template:template" as the controller and the logical path of your template.