CodeIgniter Forums
Is loading views within views a good mvc practice? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Is loading views within views a good mvc practice? (/thread-21911.html)



Is loading views within views a good mvc practice? - El Forum - 08-24-2009

[eluser]jleequeen[/eluser]
Is loading a view from within a view a good mvc practice? Or should I be loading views only from within controllers?


Is loading views within views a good mvc practice? - El Forum - 08-24-2009

[eluser]Noy Gabay[/eluser]
technically, or at least classic MVC-speaking, the views should do almost nothing but display the data.. All other actions should happen inside the controller, and all DB-related matters should go down at the model.

But, everything can be a little-bit tweaked if it makes your life easier..


Is loading views within views a good mvc practice? - El Forum - 08-24-2009

[eluser]jedd[/eluser]
[quote author="jleequeen" date="1251153363"]Is loading a view from within a view a good mvc practice? Or should I be loading views only from within controllers?[/quote]

It kind of leads you to have two levels of views, and one of them becomes an ersatz controller. I find that kind of confusing, but some people around here find it works really well for them.

I think that by using the 'load->view third parameter set to TRUE' feature, you don't really need to head down this path anyway.