Global functions |
[eluser]mabright[/eluser]
OK. I tried this with error below. Code: A PHP Error was encountered Code: Code: class Location {
[eluser]mddd[/eluser]
If you use $CI in one method, it is not set in another method! You need to make a class property $CI and, in your methods, refer to it as $this->CI. Code: class Location
[eluser]mabright[/eluser]
Wow...how much I still do not know...That did the trick, thanks alot...
[eluser]mabright[/eluser]
I have this global variable working in my view but when I reference $data['variable_name'] in my controller or model, I get an undefined variable error.
[eluser]cahva[/eluser]
If you're sending $data to view: Code: $data['variable_name'] = 'Foo'; ..then you would reference it as $variable_name in the view. EDIT: misread sorry. You ofcourse have to send the $data to your lib or model. BTW, If you need some information in almost every page, you should concider MY_Controller technique where you extend from that. Or even better, take advantage of autoloading classes in PHP5 and use technique described here by Phil Sturgeon. |
Welcome Guest, Not a member yet? Register Sign In |