gaining access to Sessions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

gaining access to Sessions

mike091

Hi, I just have a quick question regarding the best way of doing
smething. I want the username from the Session to be inserted into the
comments table when a user adds a comment. very simple. I can think of
various ways of doing it but not sure what's best. One way I thought of
was to put ..

$this->params['data']['Comment']['user'] =
$this->Session->read('User.username');

..in the Comments controller. However i'm not sure if this will work or
is the best way.

Any thoughts very welcome.
Thanks.


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

Reply | Threaded
Open this post in threaded view
|

Re: gaining access to Sessions

Grant Cox

This looks fine to me.  You can use $this->data instead of
$this->params['data'] if you like, too.


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