Skip to content

Commit f023c35

Browse files
committed
minor #9893 Better explain render() and render_esi() functions (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #9893). Discussion ---------- Better explain render() and render_esi() functions Commits ------- fd79440 Better explain render() and render_esi() functions
2 parents fecf841 + fd79440 commit f023c35

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

reference/twig_reference.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,21 @@ render
5353
``options`` *(optional)*
5454
**type**: ``array`` **default**: ``[]``
5555

56-
Renders the fragment for the given controller (using the `controller`_ function)
57-
or URI. For more information, see :doc:`/templating/embedding_controllers`.
56+
Makes a request to the given internal URI or controller and returns the result.
57+
It's commonly used to :doc:`embed controllers in templates </templating/embedding_controllers>`.
5858

59-
The render strategy can be specified in the ``strategy`` key of the options.
59+
.. code-block:: twig
6060
61-
.. tip::
61+
{# if the controller is associated with a route, use the path() or
62+
url() functions to generate the URI used by render() #}
63+
{{ render(path('latest_articles', {num: 5})) }}
64+
{{ render(url('latest_articles', {num: 5})) }}
65+
66+
{# if you don't want to expose the controller with a public URL, use
67+
the controller() function to define the controller to be executed #}
68+
{{ render(controller('AppBundle:Default:latestArticles', {num: 5})) }}
6269
63-
The URI can be generated by other functions, like `path`_ and `url`_.
70+
The render strategy can be specified in the ``strategy`` key of the options.
6471

6572
.. _reference-twig-function-render-esi:
6673

@@ -76,13 +83,9 @@ render_esi
7683
``options`` *(optional)*
7784
**type**: ``array`` **default**: ``[]``
7885

79-
Generates an ESI tag when possible or falls back to the behavior of
80-
`render`_ function instead. For more information, see
81-
:doc:`/templating/embedding_controllers`.
82-
83-
.. tip::
84-
85-
The URI can be generated by other functions, like `path`_ and `url`_.
86+
It's similar to the `render`_ function and defines the same arguments. However,
87+
it generates an ESI tag when :doc:`ESI support </http_cache/esi>` is enabled or
88+
falls back to the behavior of `render`_ otherwise.
8689

8790
.. tip::
8891

0 commit comments

Comments
 (0)