i have a little problem that i dont know what to do with.
i have a template with
- header
- content
- sidebar
- footer
on all my page the only thing that need to change is the content, so how can i pass data to my sidebar/footer
do i need to make a controller? or do i need to make a library and load it in my template.php file?
i use this template system
http://williamsconcepts.com/ci/codeigniter/libraries/template/index.html
I am not sure about your specific Template Library, but I do know that generally this is done by nesting views inside other views, and as long as the data is loaded into the initial view, it propagates to nested views as well.
Example without Template library
Controller function
first_view
In this instance, the
$datathat is loaded intofirst_viewpropagates toheader,sidebar,andfooter.So you can use
$some_varor$another_varin any of these views.UPDATE
Another way you can load data in to your views globally is with this function
Where
$datais your view data, this statement just before you load your template should allow all of this data to be accessed in any view loaded by the template. While this is a shotgun approach, it is the suggested way to do this by your chosen template library.