Beginner : call a controller within a view - 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: Beginner : call a controller within a view (/showthread.php?tid=24704) |
Beginner : call a controller within a view - El Forum - 11-17-2009 [eluser]FordEscort[/eluser] I have three views : - header_view - home_view - dynamic_menu_view and two controllers : - home_controller - dynamic_menu_controller I load the home_view by calling home_controller. I include the header_view in home_view, and in the header_view I'd like to call the dynamic_menu_controller to load the dynamic_menu_view. I know I can do this by simply writing $this->load->view('dynamic_menu_view') in the header_view, but I want a separated controller which will generate the data for the menu. I've already seen something like this somewhere in the forum but I don't remember where. Can you help me please? Thanks. Beginner : call a controller within a view - El Forum - 11-17-2009 [eluser]rogierb[/eluser] You cannot call a controller from a view(except through ajax). You can call helper functions so I suggest you change your dynamic_menu_controller in a dynamic_menu_helper. Also it is not the MVC way. Beginner : call a controller within a view - El Forum - 11-17-2009 [eluser]FordEscort[/eluser] OK. Thanks. |