Fixed - the domain variable was preventing the write.
On Jun 23, 3:35 pm, starkey <[email protected]> wrote: > This line writes a cookie just fine... however, I want to do it the > 'Cake' way... > setcookie('key2',$this->foo['key'], time()+3600,'/','localhost'); > > Thanks again! > > On Jun 23, 3:30 pm, starkey <[email protected]> wrote: > > > After following this doc my cookie won't write, what did I miss? > > > All controllers need access to the cookie data so I put the code in > > app_controller.php. I step through the code and watch it execute the > > write but nothing is written. > > > Here is the code: > > function beforeFilter() > > { > > $this->Cookie->name = 'TT2'; > > $this->Cookie->time = 3600; // seconds or '1 hour' or '5 > > days' > > $this->Cookie->path = '/'; > > $this->Cookie->domain = '.localhost'; > > $this->Cookie->secure = false; //true; //i.e. only sent if > > using secure HTTPS > > $this->Cookie->key = null; //'jsfi&FN4Onw4abdaZ'; > > > if (blah blah) > > $key = $this->Cookie->read('key'); > > else > > $this->Cookie->write('key',$this->foo['key']); > > > } > > > $key is populated at write time, NULL is always returned from the > > read. > > > Thanks for any help! > > Shawn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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?hl=en -~----------~----~----~----~------~----~------~--~---
