it worked when i called session component inside my class like this
class MessageComponent extends Object
{
var $components = array('Session');
function getMessage()
{
}
}
Hoping that this will help some others who having the same problem.
On Jul 19, 9:49 am, "Jonathan Snook" <[EMAIL PROTECTED]> wrote:
> You have a couple ways to do so.
>
> 1) use the startup method, which gets passed the controller as its
> first argument. Store a reference to it within the object.
>
> 2) App::import('Component', 'Session'); and then you should be able to
> instantiate thesessionobject and use it that way.
>
> On Sat, Jul 19, 2008 at 12:45 AM, web <[EMAIL PROTECTED]> wrote:
> > On Jul 18, 12:18 pm, web <[EMAIL PROTECTED]> wrote:
> >> Iam using cakephp1.2, and have created acustomcomponentfor
> >> messaging purpose . but amnotable to use $this->Session->read() or
> >> $this->Session->delete()insidemy class.
> >> These codes creates an error like this "Call to a member function on
> >> a non-object ". So I have to use the conventional phpsessioncodeinsidemy
> >> componentfile.
>
> >> Can anyone tell me how to getSessionhelperinsidecomponent ?
>
> >> here ismycode
> >> >> class MessageComponent extends Object
> >> {
> >> function getMessage()
> >> {
> >> $message = '';
>
> >> $msg = $this->Session->read('message');
> >> $this->Session->delete('message');
> >> if($msg != "")
> >> {
> >> switch($msg)
> >> {
> >> $message= ...
> >> }
> >> }
>
> >> return $message;
>
> >> }
> >> }
>
> >> Thanks in advance .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---