[UPHPU] Sharing included data
Jonathan Duncan
jonathan at jkdwebmagic.com
Wed Sep 6 13:18:29 MDT 2006
On Wed, 6 Sep 2006, Jon Jensen wrote:
>> However, as you can see, I have found it necessary to pass
>> the object variable back into the object in order for the
>> HEADER.INC.PHP file to be able to use the object and the data
>> in it. This makes for a messy function call like this:
>>
>> $init->auth->userStatus
>
> You probably want to use "$this" instead. Since the include file is being
> inserted right in the middle of that class function, the code is executed as
> if it were right there in the function. Any local or member variables will
> be available to it. So you can do things like this in your include file:
>
> var $foo = $this->auth->userStatus;
> var $bar = $this->someFunction();
>
Yes, that works. Thanks. I have been too wrapped up in this code to
recognize that I could use the $this for this particular usage. I
appreciate your help.
Jonathan
More information about the UPHPU
mailing list