Welcome Guest, Not a member yet? Register   Sign In
determine all variables passed into view
#1

[eluser]louis w[/eluser]
when inside of a view is there a way to access the array of variables which was passed in as a whole? i need to call a sub-view and want to pass everything into the next view but don't know all the the variable names (they will change) which were in the array.
#2

[eluser]gtech[/eluser]
you don't need to pass them on to a sub view..

what happens is when you pass a data array to a view, all other views in the same request will have those variables available. I believe this is because the loader class stores the view variables and does not unset them everytime you load a view.
#3

[eluser]louis w[/eluser]
Oooooh. They are one step ahead of me.

Thanks for making me aware of this.
#4

[eluser]gtech[/eluser]
The load class has "_ci_cached_vars" array available in the controller or view, and gets built up everytime you load a view and pass in a data array.
Code:
print_r($this->load->_ci_cached_vars);
#5

[eluser]gtech[/eluser]
No probs I only recently found this out myself.
#6

[eluser]gtech[/eluser]
sorry got to send another message as my total post count was the same as the devil.
#7

[eluser]Chris Newton[/eluser]
The devil posts here? Wink
#8

[eluser]gtech[/eluser]
yep and also shops at Tesco's.




Theme © iAndrew 2016 - Forum software by © MyBB