CodeIgniter Forums
global variable - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: global variable (/showthread.php?tid=55769)



global variable - El Forum - 11-08-2012

[eluser]Hamed[/eluser]
I have one query which I use it in lots of view files and I can not cache this query because it should be change on each request:
Now I decide to call it one time in header and use this query in other views files ut I can not and I get "Undefined variable: ratesGobal"

Is there anyway to do this job?
Now I have more than 37 query in one page.


global variable - El Forum - 11-08-2012

[eluser]Aken[/eluser]
Use $this->load->vars(). It's the same as passing a $data array in $this->load->view(), but will be globally available to any view.