CodeIgniter Forums
Issue with layouts renderer and sections => merge sections in one view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: Issue with layouts renderer and sections => merge sections in one view (/thread-75240.html)



Issue with layouts renderer and sections => merge sections in one view - RedskyThirty - 01-16-2020

Hello,

It seems that there is a problem with the layouts and I think that this is due to "ob_start / ob_flush / ..." in the renderer.
It will be easier to explain my problem with an example...

PHP Code:
public function send(): string
{
    $email view('email');
   
    
// Send email script here...

    return view('confirmation');


View "email" extends a layout "x" with a section called "body".
View "confirmation" extends another layout "y" with a section called "body".

Sometimes (but not always), "view('confirmation')" displays the "body" section of "email" and "confirmation". The renderer merges both sections even if the layout is not the same.
This is really annoying. For the moment, I try to prefix all my sections in each layouts but it would be better if I didn't have to do this kind of things.


RE: Issue with layouts renderer and sections => merge sections in one view - kilishan - 01-16-2020

Good point. PLease log that over at Github.


RE: Issue with layouts renderer and sections => merge sections in one view - RedskyThirty - 01-16-2020

(01-16-2020, 08:15 AM)kilishan Wrote: Good point. PLease log that over at Github.

Done ;-)


RE: Issue with layouts renderer and sections => merge sections in one view - kilishan - 01-16-2020

Thanks!