I know normally the data is passed thru to the view with the controller. however, currently in my view I load my model ($this->load->model('Db_model');) so i can use it in a loop to retrieve a users profile picture path from a array of IDs that is passed from controller. Will loading the db model in the view to accomplish this make my site more vulnerable or bad form? To me it seems to be outside of MVC concept but its working atm. thanks
I agree, but it has everything to do with scale. If you are designing a tiny app MVC does not really matter because it is easy to oversee the whole application. However once an application starts to grow, or if you are building a bigger application MVC separation becomes more important.
For instance if you use models in your views, this implies the design team has to know about models. It may also hamper porting the views later on to another framework or swapping templates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With