Permalink
Browse files

minor #4338 ESI Variable Details Continuation (Farkie, weaverryan)

This PR was merged into the 2.3 branch.

Discussion
----------

ESI Variable Details Continuation

This continues #4098.

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | no
| Applies to    | 2.3+
| Fixed tickets | n/a

Thanks!

Commits
-------

ded7577 Clarifying a bit more that you're passing variables into your controller
5877d02 Update http_cache.rst
  • Loading branch information...
weaverryan committed Oct 19, 2014
2 parents e8964f4 + ded7577 commit 3da0776b502dd23b399c3e005a27e965dc70e46f
Showing with 12 additions and 5 deletions.
  1. +12 −5 book/http_cache.rst
@@ -915,20 +915,20 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:
.. code-block:: jinja
{# you can use a controller reference #}
{{ render_esi(controller('...:news', { 'max': 5 })) }}
{{ render_esi(controller('...:news', { 'maxPerPage': 5 })) }}
{# ... or a URL #}
{{ render_esi(url('latest_news', { 'max': 5 })) }}
{{ render_esi(url('latest_news', { 'maxPerPage': 5 })) }}
.. code-block:: html+php
<?php echo $view['actions']->render(
new \Symfony\Component\HttpKernel\Controller\ControllerReference('...:news', array('max' => 5)),
new \Symfony\Component\HttpKernel\Controller\ControllerReference('...:news', array('maxPerPage' => 5)),
array('strategy' => 'esi'))
?>
<?php echo $view['actions']->render(
$view['router']->generate('latest_news', array('max' => 5), true),
$view['router']->generate('latest_news', array('maxPerPage' => 5), true),
array('strategy' => 'esi'),
) ?>
@@ -938,6 +938,13 @@ wondering why you would want to use a helper instead of just writing the ESI
tag yourself. That's because using a helper makes your application work even
if there is no gateway cache installed.
.. tip::
As you'll see below, the ``maxPerPage`` variable you pass is available
as an argument to your controller (i.e. ``$maxPerPage``). The variables
passed through ``render_esi`` also become part of the cache key so that
you have unique caches for each combination of variables and values.
When using the default ``render`` function (or setting the renderer to
``inline``), Symfony merges the included page content into the main one
before sending the response to the client. But if you use the ``esi`` renderer
@@ -958,7 +965,7 @@ of the master page.
.. code-block:: php
public function newsAction($max)
public function newsAction($maxPerPage)
{
// ...

0 comments on commit 3da0776

Please sign in to comment.