Skip to content

Commit a4c1e2d

Browse files
committed
Fixed code examples in cookbook/templating
1 parent c9bb545 commit a4c1e2d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cookbook/templating/PHP.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ your application configuration file:
2727
.. code-block:: xml
2828
2929
<!-- app/config/config.xml -->
30-
<framework:config ... >
30+
<framework:config ...>
3131
<!-- ... -->
32-
<framework:templating ... >
32+
<framework:templating ...>
3333
<framework:engine id="twig" />
3434
<framework:engine id="php" />
3535
</framework:templating>
@@ -38,7 +38,7 @@ your application configuration file:
3838
.. code-block:: php
3939
4040
$container->loadFromExtension('framework', array(
41-
// ...
41+
...,
4242
'templating' => array(
4343
'engines' => array('twig', 'php'),
4444
),
@@ -50,6 +50,8 @@ below renders the ``index.html.php`` template::
5050

5151
// src/Acme/HelloBundle/Controller/HelloController.php
5252

53+
// ...
54+
5355
public function indexAction($name)
5456
{
5557
return $this->render('AcmeHelloBundle:Hello:index.html.php', array('name' => $name));

cookbook/templating/twig_extension.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ To get your custom functionality you must first create a Twig Extension class.
2424
As an example we will create a price filter to format a given number into price::
2525

2626
// src/Acme/DemoBundle/Twig/AcmeExtension.php
27-
2827
namespace Acme\DemoBundle\Twig;
2928

3029
use Twig_Extension;
@@ -108,14 +107,14 @@ Using your newly created Twig Extension is no different than any other:
108107
.. code-block:: jinja
109108
110109
{# outputs $5,500.00 #}
111-
{{ '5500' | price }}
110+
{{ '5500'|price }}
112111
113112
Passing other arguments to your filter:
114113

115114
.. code-block:: jinja
116115
117116
{# outputs $5500,2516 #}
118-
{{ '5500.25155' | price(4, ',', '') }}
117+
{{ '5500.25155'|price(4, ',', '') }}
119118
120119
Learning further
121120
----------------
@@ -125,4 +124,4 @@ For a more in-depth look into Twig Extensions, please take a look at the `Twig e
125124
.. _`Twig official extension repository`: http://github.com/fabpot/Twig-extensions
126125
.. _`Twig extensions documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension
127126
.. _`global variables`: http://twig.sensiolabs.org/doc/advanced.html#id1
128-
.. _`functions`: http://twig.sensiolabs.org/doc/advanced.html#id2
127+
.. _`functions`: http://twig.sensiolabs.org/doc/advanced.html#id2

0 commit comments

Comments
 (0)