Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update http_cache.rst #4098

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,19 @@ 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::

Using render_esi with parameters doesn't use request variables - they are
passed in as named parameters. They must be named the same.

e.g. ``render_esi(controller('...:content', { max_per_page: 5, type: 'news' }``

.. code-block:: php

public function content($max_per_page = 10, $type = "news")
{


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I agree we can highlight this better. But it's also true of render, not only render_esi. Also, I think the standards are maxPerPage and the controller name should be contentAction (since most people are probably using the normal shortcut syntax for the controller.

We do show the $max variable being passed as an argument in the next example. Perhaps we just need to add a note about that. For example:

.. tip::

    Any extra variables you pass (like ``max`` in the above example) will become arguments
    to your controller (e.g. ``$max``). You can see this in the controller below.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I think we need to be explicit with the named part. Those variables were just made up to be honest, Easy to change :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Farkie You want to be explicit with the named part? So what do you mean/propose exactly? Sorry, I don't understand - I think you agree with changing the variable names but I'm not sure what you think about my other points :). Can you make the changes you think make sense? That might help.

Thanks!

When using the default ``render`` function (or setting the renderer to
``inline``), Symfony2 merges the included page content into the main one
before sending the response to the client. But if you use the ``esi`` renderer
Expand Down