• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
share data across multiple controllers and views without sessions

#1
[eluser]chinedubond[/eluser]
hi how do i share data pulled from my database with different views without using sessions.
how can i make the data global to all my views especially?
Thanks.

#2
[eluser]Yash[/eluser]
Make a model.Create function use return.

Now call this function in controller functions and pass the value to view.

Simple na...

#3
[eluser]Clooner[/eluser]
In the normal way of doing things you use the controller as a hub for the data and views. So get all the data you need in the controller and then push that into one or multiple views. What exactly are you trying to do?

#4
[eluser]chinedubond[/eluser]
hello thanks for your replies but i know how to make data available to views like you said
but what i want to be is this.

1. get a result set from a model - done.
2. send to a view - done

the problem is i want the same data shared to other views and controller
i tried using
$this->load->vars();
but it seems the data only lasts for one request.

then tried to share the same data within multiple controller without putting the data in a session;

How do you make data global in such a way that a function only calls it once then it is shared amongst multiple controllers that need it with out using sessions.

#5
[eluser]Clooner[/eluser]
Try extending your controller with a my_controller. Use the contructor in my_controller to load the data you want available in all your controllers. Extend your own controllers from my_controller. All the data should be available through all your controllers. Or you could use a library which you call in all your controllers

Hope this helps.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.