Jan Marek / Webloader and components in body adding javascripts

3 years ago

mcmatak
Member | 492
+
0
-

I have layout like this

{contentType text/html; charset=utf-8}
{capture $_captureHtmlBody}
    <body>
        {control testControl}
    </body>
{/capture}

<html>
    <head>
        {control css}
        {control js}
    </head>
    {$_captureHtmlBody|noescape}
</html>

That is bcs any control attached into template could add any css or javascripts it needs, and this scripts we need to be rendered in head by Jan Marek / Webloader.

But if you have ajax request and only some snippets should be rendered, so the nette will check

https://github.com/…/Session.php#L540

if (!headers_sent() && ob_get_level() && ob_get_length()) {
    trigger_error('Possible problem: you are starting session while already having some data in output buffer. This may not work if the outputted data grows. Try starting the session earlier.', E_USER_NOTICE);

and throw error.

Do you have idea what to do with this? How to solve it?