Creating a template in CodeIgniter |
[eluser]Unknown[/eluser]
Hello, I'm new to CodeIgniter. Something work, but some things don't work. I've created some views: - header - navigation - mainheader - maindata - footer On every page, 'header', 'navigation' and 'footer' are the same. Only mainheader (page title) and maindata (page data) will change. I want to create a template, so i don't need to load all of these views everytime I've created a class with this function Code: Class Main extends Controller { My idea was: load an URL like http://www.website.com/index/aController/aFunction/ and this function pass the controller name (aController) and function name (aFunction) to the variable $viewToLoad, load the views and everything looks fine in the webbrowser. But, this is only working when the controller Main is always called from everywhere. How can i do this?
[eluser]tonanbarbarian[/eluser]
sounds like what you need is a layout library try one of these layout_library Template Library I have use the first one successfully in a couple of projects now. Do not try to have a main controller that calls other controllers, it just does not work that way. Several people have tried with limited success I believe. If you feel you MUST do it that way then build what you are trying to do as Libraries instead.
[eluser]Unknown[/eluser]
Thank you, tonanbarbarian! That is exactly what i want. |
Welcome Guest, Not a member yet? Register Sign In |