Is it possible to flush output buffer before rendering completed? My point is to improve perceived performance of the website.
E.g. there is a big table (like 5 000 rows) in admin interface to be rendered. I'd like to tell Twig/Symfony to flush output right after </head>
has been rendered, so the browser can start downloading styles/javascript, and then flush output after every 500 rows.
What you want to use is the Twig {% flush %}
command which is the equivalent of the PHP function flush()
. Place it right after the </head>
tag in your template for it to send the current buffer to the browser. Each time you call it it will output any output buffered so putting it in a loop will work fine.
For more info see the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With