diff --git a/best_practices/configuration.rst b/best_practices/configuration.rst index 160e707048f..7f4d99c204d 100644 --- a/best_practices/configuration.rst +++ b/best_practices/configuration.rst @@ -128,7 +128,7 @@ from places with access to the Symfony container. Constants can be used for example in your Twig templates thanks to the `constant() function`_: -.. code-block:: html+jinja +.. code-block:: html+twig
Displaying the {{ constant('NUM_ITEMS', post) }} most recent results. diff --git a/best_practices/forms.rst b/best_practices/forms.rst index 12255f37cfc..86b57e633d6 100644 --- a/best_practices/forms.rst +++ b/best_practices/forms.rst @@ -137,7 +137,7 @@ This is also an important error, because you are mixing presentation markup always a good practice to follow, so put all the view-related things in the view layer: -.. code-block:: html+jinja +.. code-block:: html+twig {{ form_start(form) }} {{ form_widget(form) }} @@ -157,7 +157,7 @@ One of the simplest ways - which is especially useful during development - is to render the form tags and use ``form_widget()`` to render all of the fields: -.. code-block:: html+jinja +.. code-block:: html+twig {{ form_start(form, {'attr': {'class': 'my-form-class'} }) }} {{ form_widget(form) }} diff --git a/best_practices/web-assets.rst b/best_practices/web-assets.rst index dd66ce8e2f6..a4160d62e2e 100644 --- a/best_practices/web-assets.rst +++ b/best_practices/web-assets.rst @@ -16,7 +16,7 @@ the application assets are in one location. Templates also benefit from centralizing your assets, because the links are much more concise: -.. code-block:: html+jinja +.. code-block:: html+twig @@ -54,7 +54,7 @@ of compiling assets developed with a lot of different frontend technologies like LESS, Sass and CoffeeScript. Combining all your assets with Assetic is a matter of wrapping all the assets with a single Twig tag: -.. code-block:: html+jinja +.. code-block:: html+twig {% stylesheets 'css/bootstrap.min.css' diff --git a/book/controller.rst b/book/controller.rst index 83870dc83da..cc7774d85b2 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -659,7 +659,7 @@ read any flash messages from the session:: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig {% for flash_message in app.session.flashbag.get('notice') %}
Username: {{ app.user.username }}
diff --git a/book/templating.rst b/book/templating.rst index feeae015e01..0a4dc85dd17 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -57,7 +57,7 @@ But Symfony packages an even more powerful templating language called `Twig`_. Twig allows you to write concise, readable templates that are more friendly to web designers and, in several ways, more powerful than PHP templates: -.. code-block:: html+jinja +.. code-block:: html+twig @@ -94,7 +94,7 @@ Twig also contains **filters**, which modify content before being rendered. The following makes the ``title`` variable all uppercase before rendering it: -.. code-block:: jinja +.. code-block:: twig {{ title|upper }} @@ -111,7 +111,7 @@ and new functions can be easily added. For example, the following uses a standard ``for`` tag and the ``cycle`` function to print ten div tags, with alternating ``odd``, ``even`` classes: -.. code-block:: html+jinja +.. code-block:: html+twig {% for i in 0..10 %}Username: {{ app.user.username }}
{% if app.debug %} @@ -1450,7 +1450,7 @@ covered: functionality would have a template called ``blog/layout.html.twig`` that contains only blog section-specific elements; - .. code-block:: html+jinja + .. code-block:: html+twig {# app/Resources/views/blog/layout.html.twig #} {% extends 'base.html.twig' %} @@ -1465,7 +1465,7 @@ covered: section template. For example, the "index" page would be called something close to ``blog/index.html.twig`` and list the actual blog posts. - .. code-block:: html+jinja + .. code-block:: html+twig {# app/Resources/views/blog/index.html.twig #} {% extends 'blog/layout.html.twig' %} @@ -1502,7 +1502,7 @@ this classic example: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig Hello {{ name }} @@ -1555,7 +1555,7 @@ HTML code. By default, Twig will escape the article body. To render it normally, add the ``raw`` filter: -.. code-block:: jinja +.. code-block:: twig {{ article.body|raw }} @@ -1617,7 +1617,7 @@ for example, inside your controller:: The same mechanism can be used in Twig templates thanks to ``dump`` function: -.. code-block:: html+jinja +.. code-block:: html+twig {# app/Resources/views/article/recent_list.html.twig #} {{ dump(articles) }} @@ -1688,7 +1688,7 @@ key in the parameter hash: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig PDF Version diff --git a/book/translation.rst b/book/translation.rst index 9ea6db1a6f8..7cd2fe0e8a9 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -232,7 +232,7 @@ Twig Templates Symfony provides specialized Twig tags (``trans`` and ``transchoice``) to help with message translation of *static blocks of text*: -.. code-block:: jinja +.. code-block:: twig {% trans %}Hello %name%{% endtrans %} @@ -256,7 +256,7 @@ works when you use a placeholder following the ``%var%`` pattern. You can also specify the message domain and pass some additional variables: -.. code-block:: jinja +.. code-block:: twig {% trans with {'%name%': 'Fabien'} from "app" %}Hello %name%{% endtrans %} @@ -271,7 +271,7 @@ You can also specify the message domain and pass some additional variables: The ``trans`` and ``transchoice`` filters can be used to translate *variable texts* and complex expressions: -.. code-block:: jinja +.. code-block:: twig {{ message|trans }} @@ -289,7 +289,7 @@ texts* and complex expressions: that your translated message is *not* output escaped, you must apply the ``raw`` filter after the translation filter: - .. code-block:: jinja + .. code-block:: twig {# text translated between tags is never escaped #} {% trans %} @@ -306,7 +306,7 @@ texts* and complex expressions: You can set the translation domain for an entire Twig template with a single tag: - .. code-block:: jinja + .. code-block:: twig {% trans_default_domain "app" %} diff --git a/book/validation.rst b/book/validation.rst index 13fd4954c50..8856de1d304 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -180,7 +180,7 @@ Inside the template, you can output the list of errors exactly as needed: .. configuration-block:: - .. code-block:: html+jinja + .. code-block:: html+twig {# app/Resources/views/author/validation.html.twig #}