Welcome Guest, Not a member yet? Register   Sign In
A way to have a variable sent to all views?
#1

[eluser]internut[/eluser]
Is there a way I can create a library to load something into a $data array if i'm always using:

Code:
$this->load->view('users_view',$data);

or

Code:
$this->load->view('something_else',$data);

?
IE: wanting to show a config or variable set once in all views?
#2

[eluser]Randy Casburn[/eluser]
If the library was autoloaded and the array was built in the constructor.

that won't load the view...that just answers the question posed in the post specifically about loading up the data into the array.

loading the view is a different topic ;-)

Randy
#3

[eluser]Colin Williams[/eluser]
I've got a soon-to-be-released library that I think will help you out. It takes a different approach to defining variable to views, whereby 'variables' are more like 'regions' and you then write to these regions. It's got some other goodies, too. PM if this interests you.




Theme © iAndrew 2016 - Forum software by © MyBB