![]() |
doubt with controllers - 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: doubt with controllers (/showthread.php?tid=9077) |
doubt with controllers - El Forum - 06-11-2008 [eluser]kmil0[/eluser] Hi guys! I am creating an application to understand how CodeIgniter works, and I doubt has arisen. Suppose that the application has a menu and a dynamic main <div>, in the menu the links are read from a database, and this menu is constant except when it adds a new link from a form. every time you reload the page (whatever the controller), I suppose that the menu should be read what is new in the database. but, how can I do this if CodenIgniter just let me load one controller? can I execute a external function from the template (the main view) to show the "links" ? something like. <template> <menu> <?php showLinks(); ?> </menu> <dynamicdiv> // dynamic content </div> </templte> thanks for help. excuse my bad english ![]() doubt with controllers - El Forum - 06-11-2008 [eluser]stuffradio[/eluser] Yes... this gets controlled in the controller ![]() Example for how it would be done (without the database) Code: <?php Template Code: <html> doubt with controllers - El Forum - 06-11-2008 [eluser]kmil0[/eluser] Hi stuffradio, thanks for the fast response. but.. what if the menu must be in all the views?? do i have to create always something like Code: $data['links'] = $this->model->get_links(); ? right now i'm working with something like this. i have a template( template.php ) Code: <html> my controllers always make this if they wanna load a view with the template tempalte.php Code: function foo(){ and I dont need to load always the header, footer, menu. but.. what i want to do.. is.. load some dynamic content in the <div id="menu"></div> calling a showFunction(); or something like that. thanks again ![]() doubt with controllers - El Forum - 06-11-2008 [eluser]stuffradio[/eluser] Yes, but there is some way you can do it automatically. You could autoload the model, and then call it always. I'm not too sure how to explain it right now, it's pretty much bed time for me ![]() doubt with controllers - El Forum - 06-11-2008 [eluser]kmil0[/eluser] ok men. thanks for your time ![]() i will try ![]() |