CodeIgniter Forums
Dynamic content in a view file? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Dynamic content in a view file? (/showthread.php?tid=13625)



Dynamic content in a view file? - El Forum - 11-30-2008

[eluser]Unknown[/eluser]
I'm bulding a website with all of the pages using the same view file.A pass the unique and dynamic generated content from each controller to the view file. Right now, I've made a library which is used to create a very simple menu. Since the library will be used on 99% of all my pages, it's automatically loaded by autoload.php.
However, and this is where I get uncertain, where is the best place to use the print_menu()?
Should I request it each and every controller and pass it to the view, or is it possible to request the function from the view file?


Dynamic content in a view file? - El Forum - 11-30-2008

[eluser]Thorpe Obazee[/eluser]
You can create a library to for loading dynamic content on the view file so you don't need to call that method from every controller.


Dynamic content in a view file? - El Forum - 12-02-2008

[eluser]Unknown[/eluser]
Thanks for your advice Smile