![]() |
Equavalent of Cake "Elements" - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Equavalent of Cake "Elements" (/showthread.php?tid=10110) |
Equavalent of Cake "Elements" - El Forum - 07-18-2008 [eluser]august.gresens[/eluser] Hello I'm a recent convert to CI, having abandoned the intricacies of CakePHP for something a bit more transparent. There are a few features I miss, one being the "Elements" construct. I'm sure there is an easy way to do the same thing in CI. Do I just use include directives? Thanks, August Equavalent of Cake "Elements" - El Forum - 07-19-2008 [eluser]m4rw3r[/eluser] You can use $this->load->view(); inside another view to load subviews (or "view elements"). They share the same variables as the view that included them (I think). Equavalent of Cake "Elements" - El Forum - 07-19-2008 [eluser]Bramme[/eluser] You're right m4rw3r, it does share it... What often do is create an index view file that looks like this Code: <?php And then you can make your controller look like Code: //do lots of nifty things All variables passed to index, will get passed to footer, header and $page. Equavalent of Cake "Elements" - El Forum - 07-20-2008 [eluser]august.gresens[/eluser] After searching some more, I found this info on the forums with some code to do this: http://ellislab.com/forums/viewthread/66997/ A |