Welcome Guest, Not a member yet? Register   Sign In
How to declear global variable in Controller?
#1

[eluser]PEN Vannak[/eluser]
Dear CodIgnitor members,

I have the problem with CodeIgnitor when I want to declear the variable in the class controller.
Could you explain me?
#2

[eluser]Thorpe Obazee[/eluser]
[quote author="PEN Vannak" date="1245739774"]Dear CodIgnitor members,

I have the problem with CodeIgnitor when I want to declear the variable in the class controller.
Could you explain me?[/quote]

what do you mean by declear?
#3

[eluser]tonanbarbarian[/eluser]
since every request in CI revolves around a single controller, rather than creating a global variable you can simply just create a property of the controller

i.e. if previously you wanted to create a global variable like this
Code:
global $myvar;
$myvar = 'abc';
try doing this instead
Code:
$this->myvar = 'abc';

Then if you want to access this in the model, libraries etc
Code:
$CI =& get_instance();
echo $CI->myvar;
#4

[eluser]Thorpe Obazee[/eluser]
[quote author="bargainph" date="1245740029"][quote author="PEN Vannak" date="1245739774"]Dear CodIgnitor members,

I have the problem with CodeIgnitor when I want to declear the variable in the class controller.
Could you explain me?[/quote]

what do you mean by declear?[/quote]

so it's declare. I was leaning to the 'opposite of clear' option Tongue
#5

[eluser]Colin Williams[/eluser]
[quote author="bargainph" date="1245740131"][quote author="bargainph" date="1245740029"][quote author="PEN Vannak" date="1245739774"]Dear CodIgnitor members,

I have the problem with CodeIgnitor when I want to declear the variable in the class controller.
Could you explain me?[/quote]

what do you mean by declear?[/quote]

so it's declare. I was leaning to the 'opposite of clear' option Tongue[/quote]

We are also "CodIgnitors" so we must be setting fish on fire...




Theme © iAndrew 2016 - Forum software by © MyBB