Welcome Guest, Not a member yet? Register   Sign In
Setting a global variable in a controller?
#7

[eluser]xwero[/eluser]
First of all if you want to add a class variable you should define it in the top of your class
Code:
class somename
{

   var $omit;
}
The var keyword is the same as public in php5 but in php5 you can limit the scope of the variable with the protected and private keywords.

When you define the variable it's possible to add a default value like you do with normal values.

Matrices in your methods you can use $this->omit in place of the $omit variable name.

Hannes the load->vars method is meant to collect variables for the view files not as a substitute for class variables.


Messages In This Thread
Setting a global variable in a controller? - by El Forum - 08-07-2008, 11:42 AM
Setting a global variable in a controller? - by El Forum - 08-07-2008, 01:28 PM
Setting a global variable in a controller? - by El Forum - 08-07-2008, 01:29 PM
Setting a global variable in a controller? - by El Forum - 08-07-2008, 02:02 PM
Setting a global variable in a controller? - by El Forum - 08-07-2008, 02:06 PM
Setting a global variable in a controller? - by El Forum - 08-07-2008, 02:52 PM
Setting a global variable in a controller? - by El Forum - 08-08-2008, 12:15 AM
Setting a global variable in a controller? - by El Forum - 08-08-2008, 12:33 AM
Setting a global variable in a controller? - by El Forum - 08-08-2008, 01:03 AM
Setting a global variable in a controller? - by El Forum - 08-08-2008, 01:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB