Welcome Guest, Not a member yet? Register   Sign In
A Controller Load a View by another Controller
#1

[eluser]Sarwar CSE[/eluser]
I have designed a template, which have three panels left, middle & right. Some module will be loaded in the left panel. Every module contain a model, controller & view. I want let the module be loaded by their controller in my left panel
I can load the module like this way :-
Code:
$data['leftpanel'].=$this->load->view('news','',true);
If I load news module by this way then the variable I am using in the view are coming from news controller is getting these data from news model. So I can’t load the model like this.
So what’s the feasible solution.
#2

[eluser]jedd[/eluser]
If I'm parsing your question correctly, one solution is to generate your common view partials in MY_Controller.

Have a read of [url="/wiki/Header_and_Footer_and_Menu_on_every_page_-_jedd/"]this page[/url] and see if that approach would work for you.

I'm not sure at what level of complexity or size it becomes infeasible to do all these potential view partials in MY_Controller. Given most of the grunt work should be happening in your model(s) though, it should be fine.




Theme © iAndrew 2016 - Forum software by © MyBB