Langdon,

Not to sound stupid, but did you check to see if the variable that you store the session object is not out of scope outside of the start up function?

On 7/9/06, kitten <[EMAIL PROTECTED]> wrote:

Hi Langdon,

>
> The component has the code you recommended in its startup() method, and
> I can access the Session component fine within startup(), but nowhere
> else in the component.

If you can access the Session object from the startup method through
$this->Controller->Session, it _should_ be available from within all methods
of the component.

No other ideas than to ask you if you re-checked for typos etc...

Best

Heiner
>
> Regards,
> Langdon
>
>
> kitten wrote:
>> Hi,
>>
>> You can put this in your Component's startup() method:
>>
>>     function startup(&$controller) {
>>         $this->Controller =& $controller;
>>     }
>>
>> They you can access the Session object (and all other controller data)
>> through
>>
>> $this->Controller->Session->read('theData');
>>
>> Hope this helps ;-)
>>
>> Heiner
>>
>>
>>
>>
>>
>>> Hi
>>>
>>> I am attempting to access the Session component from inside another
>>> Component.
>>>
>>> For instance like this:
>>>
>>> $someData = $this->Session->read('theData');
>>>
>>>
>>> However when I run the page I get the following error:
>>>
>>> Fatal error: Call to a member function on a non-object in
>>> /web_servers/dev/app/controllers/components/mycomponent.php on line 336
>>>
>>>
>>> I have the session component set at the top of the component:
>>>
>>> var $components = Array ('Session');
>>>
>>> I am obviously missing something fundamental here.  Can anyone explain
>>> to me how to access the functions of one component inside another?
>>>
>>> Regards,
>>> Langdon
>
> >





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to