But the sessions controller works without it. Shouldn't the messages
controller work without it also? I added it anyways, and it still
didn't work.

On May 3, 6:21 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> Include the session component....
>
> On May 3, 3:59 pm, LordZardeck <s...@blackfireweb.com> wrote:
>
>
>
>
>
> > For some reason, the session handling works in one controller and not
> > the other. I can't figure out why. I am using CakePHP 1.2.5.
>
> > //
> > //Does work
> > //
>
> > sessions_controller.php:
>
> > class SessionsController extends AppController {
> >     var $name = "Sessions";
> >     var $layout = "ajax";
> >     var $uses = array();
>
> >     function create(){
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >     }
>
> > }
>
> > create.ctp:
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["data"] = $data;
> > echo json_encode($msgJson);
> > //results in ({"SessionID":"sd8s8o32edmjnjt94ouse99fd2","data":19409})
> > every time (parenthesis not in result)
>
> > //
> > //Doesn't Work
> > //
>
> > messages_controller.php:
>
> > class MessagesController extends AppController {
>
> >     var $name = 'Messages';
> >     var $layout = "ajax";
>
> >     function listMessages() {
> >         if($this->Session->read('Data') == null){
> >             $this->Session->write('Data', rand());
> >         }
> >         $this->set('data', $this->Session->read('Data'));
> >         $this->set('SessionID', $this->Session->id());
> >         $this->set('messages', $this->Message->find("all",
> > array("order"=>"priority ASC")));
> >     }
>
> > }
>
> > list_messages.ctp:
>
> > $msgJson["count"] = count($messages);
> > $msgJson["SessionID"] = $SessionID;
> > $msgJson["SessionData"] = $data;
> > foreach($messages as $message){
> >     $msg[] = $message["Message"];}
>
> > $msgJson["items"] = $msg;
> > echo json_encode($msgJson);
> > /*
> > results in ({"count":3,"SessionID":"","SessionData":27384,"items":
> > [{"id":"4","priority":"3","subject":"Another
> > message","message":"adsfasdf"},
> > {"id":"2","priority":"3","subject":"testing again","message":"just
> > seeing ow "},
> > {"id":"7","priority":"3","subject":"asdgasdg","message":"asdfasdfasd"}]})
> > except the SessionData changes everytime and the SessionID never shows
> > up.
> > */
>
> > Any ideas what might be wrong?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en- Hide quoted text -
>
> - Show quoted text -

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to