Welcome Guest, Not a member yet? Register   Sign In
Setting default variables in a controller
#6

[eluser]Glen Swinfield[/eluser]
Just keep using $this->

for example:

Code:
function whatever{
   $this->page_vars = array(); // now assigned as available throughout the class
   //Then
   $this->page_vars['keyname'] = 'mystring';
}

Then access the values like this:

Code:
echo $this->page_vars['keyname']; //prints 'mystring';

It's all about $this when you're using objects - check the php manual for more info.


Messages In This Thread
Setting default variables in a controller - by El Forum - 07-15-2007, 12:15 AM
Setting default variables in a controller - by El Forum - 07-15-2007, 02:35 AM
Setting default variables in a controller - by El Forum - 07-15-2007, 02:41 AM
Setting default variables in a controller - by El Forum - 07-15-2007, 02:52 AM
Setting default variables in a controller - by El Forum - 07-15-2007, 02:59 AM
Setting default variables in a controller - by El Forum - 07-15-2007, 03:41 AM
Setting default variables in a controller - by El Forum - 07-15-2007, 03:43 AM
Setting default variables in a controller - by El Forum - 07-15-2007, 04:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB