How to render section in nested view? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: How to render section in nested view? (/showthread.php?tid=79132) |
How to render section in nested view? - sfarzoso - 04-27-2021 I have this layout: PHP Code: <!DOCTYPE html> In my View I have this implementation: PHP Code: <?= $this->include('App\Views\Backend\load\datatables') ?> as you can see I call layout\index to include the View in the body content. Now the problem's that inside Media\list I have a section called js: PHP Code: <?= $this->section('js') ?> and this raise an error: PHP Code: View themes, no current section urrent section current section RE: How to render section in nested view? - paliz - 04-27-2021 Migrate to ci4 RE: How to render section in nested view? - sfarzoso - 04-27-2021 (04-27-2021, 09:14 AM)paliz Wrote: Migrate to ci4 well.. I'm using CI4 RE: How to render section in nested view? - iRedds - 04-28-2021 I think you should use $this->include() instead of view() in your template. RE: How to render section in nested view? - sfarzoso - 04-28-2021 (04-28-2021, 10:42 PM)iRedds Wrote: I think you should use $this->include() instead of view() in your template. I've also tried with include but same result RE: How to render section in nested view? - iRedds - 04-29-2021 Oh really. I missed it. If I understand the code correctly, in the current implementation you cannot use nested sections. RE: How to render section in nested view? - sfarzoso - 04-29-2021 (04-29-2021, 01:09 AM)iRedds Wrote: Oh really. I missed it. mmm so I have to create one js file that handle all the logic and then include it in the main view? RE: How to render section in nested view? - iRedds - 04-29-2021 I added a PR to solve this problem. https://github.com/codeigniter4/CodeIgniter4/pull/4622 RE: How to render section in nested view? - iRedds - 04-29-2021 (04-29-2021, 02:05 AM)sfarzoso Wrote: mmm so I have to create one js file that handle all the logic and then include it in the main view? If this solution suits you, then I cannot stop you =) |