Skip to content

Update esi.rst #7653

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

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
5 changes: 4 additions & 1 deletion http_cache/esi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:
.. code-block:: html+php

<!-- app/Resources/views/static/about.html.php -->

<?php
// you can use a controller reference
use Symfony\Component\HttpKernel\Controller\ControllerReference;
?>
<?php echo $view['actions']->render(
Copy link
Contributor

Choose a reason for hiding this comment

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

It's useless to have end/open blocks.

Copy link
Member

Choose a reason for hiding this comment

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

It's "useless" most of the times ... but in this case this is an example of a PHP template, so you must open/close PHP tags whenever you add PHP code. However, I don't know which is the current practice in the docs regarding the use ... imports. Maybe we do an exception for those blocks? Let's ask to @wouterj and @xabbuh. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In other template code examples, each piece of PHP code is surrounded by open/close tags as @javiereguiluz said? I just did the same and I am not sure about what's the correct practice in this case

new ControllerReference(
'AppBundle:News:latest',
Expand All @@ -148,8 +149,10 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:
array('strategy' => 'esi')
) ?>

<?php
// ... or a URL
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
?>
<?php echo $view['actions']->render(
$view['router']->generate(
'latest_news',
Expand Down