CodeIgniter Forums
add CI4 view features like in CI3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: add CI4 view features like in CI3 (/showthread.php?tid=82714)



add CI4 view features like in CI3 - galih.lasahido - 08-14-2022

Hi Guys,

Anyone can help, i want to add template features in CI4 like extend, section, endSection, and renderSection to CI3, anyone can help ?


RE: add CI4 view features like in CI3 - iRedds - 08-15-2022

"Hey man don't get too attached to things... Learn to let go"(с) i.vanko
use CI4 =)


RE: add CI4 view features like in CI3 - kilishan - 08-15-2022

If you're unable to move to CI4 with an existing project, then it's possible, but you'll have to put a little work in.

The main thing to understand is that $this within a view references the View class that is doing the actual rendering. So, in CI3, you'd need to extend the view class with a MY_View and add the features into that class.

You can look at CI 4's View class to see how it's done there.