Sharing data accross controllers |
[eluser]xare[/eluser]
Hello I have doubt. Lets imagine I have a couple of controller classes. One called home and the other called contact. There is a number of data that I want to pass to both controllers' views. For example the title of the page. The way I know how to do it is by doing the following file home.php Code: <?php Now I rewrite code for the contact controller Code: <?php Is there any way I can send the variable title to more than one view from a general controller. I mean when I load variables I want to be accessed by more than one view, where could I write them down so to not to copy the code in every controller?
[eluser]n0xie[/eluser]
Make use of base_controller_classes: http://philsturgeon.co.uk/news/2010/02/C...ing-it-DRY
[eluser]ahmed hamza[/eluser]
try tu use session class in CI it will help u to share data across the entire site |
Welcome Guest, Not a member yet? Register Sign In |