Flushing the product before rendering in Symfony / Twig

Is it possible to flush the output buffer before rendering is complete? I want to improve the perception of the website.

eg. there is a large table in the admin interface (for example, 5,000 rows). I would like to tell Twig / Symfony to clear the output right after display </head>, so the browser can start loading styles / javascript and then clear the output after every 500 lines.

+4
source share
1 answer

What you want to use is the Twig command {% flush %}, which is equivalent to the PHP function flush(). Place it immediately after the tag </head>in your template so that it can send the current buffer to the browser. Each time you call it, it displays any output buffer, so its inclusion in the loop will work fine.

See the docs for more information .

+9
source

Source: https://habr.com/ru/post/1528194/


All Articles