Re: Formatar a mensagem - $this->Session->setFlash(__('minha msg'));
Seguinte, o método setFlash aceita 4 parâmetros: 1) String da mensagem; 2) * element* que será usado; 3) array de parâmetros; e 4) índice da mensagem na sessão; Vejo pelo menos três formas de você fazer isso: 1. Criando um *element* para cada tipo de mensage; 2. Com apenas um *element* e passando a *class* "good/bad" para mudar o estilo de exibição; 3. Usar índices diferentes e, com isso, você pode colocar em div's diferentes. Lembro que uma vez tive o mesmo problema e escolhi usar um *element* só passando a *class*, deu certo pra mim. Se ainda tiver dúvida, pode perguntar. Att, -- Luiz Antonio S Messias Desenvolvedor Web <http://twitter.com/tonyzrp> @tonyzrp <http://twitter.com/tonyzrp> *LinkedIn* <http://www.linkedin.com/in/luizantoniosmessias> 2013/4/22 Anderson Moraes > Tony, obrigado pela resposta. > > Não entendi muito bem como por em prática o que vc me passou, eu tenho que > criar um estilo para cada tipo de mensagem (bad / good)??? > > > > Em segunda-feira, 22 de abril de 2013 17h17min15s UTC-3, Anderson Moraes > escreveu: > >> Boa tarde pessoal, >> >> Então, na página default.ctp eu tenho a seguinte linha: > $this->Session->flash(); ?> >> Quando uma mensagem é setada é essa linha que exibe, correto? >> >> Então se eu tenho uma mensagem de sucesso: $this->Session->setFlash(__('* >> *Usuário cadastrado com sucesso.')); eu gostaria que o background-color >> da minha mensagem fosse verde e só exibisse o vermelho em casos onde a >> mensagem tenha uma relação negativa, ex.: >> $this->Session->setFlash(__('**Usuário >> ou senha inválidos.')); >> >> o CakePHP 2.x tem alguma forma de informar qual "style" usuar na >> mensagem??? >> >> Grato desde já, >> >> Anderson >> > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Formatar a mensagem - $this->Session->setFlash(__('minha msg'));
Tony, obrigado pela resposta. Não entendi muito bem como por em prática o que vc me passou, eu tenho que criar um estilo para cada tipo de mensagem (bad / good)??? Em segunda-feira, 22 de abril de 2013 17h17min15s UTC-3, Anderson Moraes escreveu: > > Boa tarde pessoal, > > Então, na página default.ctp eu tenho a seguinte linha: $this->Session->flash(); ?> > Quando uma mensagem é setada é essa linha que exibe, correto? > > Então se eu tenho uma mensagem de sucesso: > $this->Session->setFlash(__('Usuário cadastrado com sucesso.')); eu > gostaria que o background-color da minha mensagem fosse verde e só exibisse > o vermelho em casos onde a mensagem tenha uma relação negativa, ex.: > $this->Session->setFlash(__('Usuário ou senha inválidos.')); > > o CakePHP 2.x tem alguma forma de informar qual "style" usuar na > mensagem??? > > Grato desde já, > > Anderson > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Formatar a mensagem - $this->Session->setFlash(__('minha msg'));
Tem isso aqui: http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#creating-notification-messages Att, -- Luiz Antonio S Messias Desenvolvedor Web <http://twitter.com/tonyzrp> @tonyzrp <http://twitter.com/tonyzrp> *LinkedIn* <http://www.linkedin.com/in/luizantoniosmessias> 2013/4/22 Anderson Moraes > Boa tarde pessoal, > > Então, na página default.ctp eu tenho a seguinte linha: $this->Session->flash(); ?> > Quando uma mensagem é setada é essa linha que exibe, correto? > > Então se eu tenho uma mensagem de sucesso: > $this->Session->setFlash(__('Usuário cadastrado com sucesso.')); eu > gostaria que o background-color da minha mensagem fosse verde e só exibisse > o vermelho em casos onde a mensagem tenha uma relação negativa, ex.: > $this->Session->setFlash(__('Usuário ou senha inválidos.')); > > o CakePHP 2.x tem alguma forma de informar qual "style" usuar na > mensagem??? > > Grato desde já, > > Anderson > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Formatar a mensagem - $this->Session->setFlash(__('minha msg'));
Boa tarde pessoal, Então, na página default.ctp eu tenho a seguinte linha: Session->flash(); ?> Quando uma mensagem é setada é essa linha que exibe, correto? Então se eu tenho uma mensagem de sucesso: $this->Session->setFlash(__('Usuário cadastrado com sucesso.')); eu gostaria que o background-color da minha mensagem fosse verde e só exibisse o vermelho em casos onde a mensagem tenha uma relação negativa, ex.: $this->Session->setFlash(__('Usuário ou senha inválidos.')); o CakePHP 2.x tem alguma forma de informar qual "style" usuar na mensagem??? Grato desde já, Anderson -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Fatal Error on call to '$this->Session->setFlash'
AppController extends "Controller" class...and in this class it was automatically added this component. -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/9/13 McScreech > Thank you very much, I had forgot to include the Session component. > > I haven't begun a new project in some time (since about cake 1.2) - forgot > some basis setup stuff, I guess I was thinking the basic components and > helpers were included by default. > > I do wonder however, how it _was_ able to work on my first few passes with > the freshly baked app with no comonents or helpers included before I > started to modify it? > > Thanx again, McS > > > On Thursday, 13 September 2012 09:37:52 UTC-4, MaJerle.Eu wrote: >> >> first..your controller should extends AppController, than make sure >> SessionComponent in included in your component list :) >> -- >> Lep pozdrav, Tilen Majerle >> http://majerle.eu >> > -- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > > -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Fatal Error on call to '$this->Session->setFlash'
Thank you very much, I had forgot to include the Session component. I haven't begun a new project in some time (since about cake 1.2) - forgot some basis setup stuff, I guess I was thinking the basic components and helpers were included by default. I do wonder however, how it _was_ able to work on my first few passes with the freshly baked app with no comonents or helpers included before I started to modify it? Thanx again, McS On Thursday, 13 September 2012 09:37:52 UTC-4, MaJerle.Eu wrote: > > first..your controller should extends AppController, than make sure > SessionComponent in included in your component list :) > -- > Lep pozdrav, Tilen Majerle > http://majerle.eu > -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Fatal Error on call to '$this->Session->setFlash'
first..your controller should extends AppController, than make sure SessionComponent in included in your component list :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/9/13 McScreech > G'day, > > I do not understand how I induced this error: > 'Error: Call to a member function setFlash() on a non-object' > which happens on any call to '$this->Session->setFlash' as noted in the > default edit (or add) function below? > > I was adding options to the related form (option lists, labels, titles) > when I broke it and have been looking for misplaced or missing closing > parens, braces, brackets, or commas with no luck. This is a bare-bones > data-entry app with _nothing_ extra included other than the DebugKit > plugin. I did notice that even though the flash message fails the changes > made by editing or adding a record _are_ correctly saved to the db and > displayed in the index view when refreshed. > > Any hints on where to look next will be greatly appreciated. > > MTIA, McS > > public function edit($id = null) { > $this->Batch->id = $id; > if (!$this->Batch->exists()) { > throw new NotFoundException('Invalid batch'); > } > if ($this->request->is('post') || $this->request->is('put')) { > if ($this->Batch->save($this->request->data)) { > $this->Session->setFlash('The batch has been saved'); /*this line*/ > $this->redirect(array('action' => 'index')); > } else { > $this->Session->setFlash('The batch could not be saved. Please, try > again.'); /*this line*/ > } > } else { > $this->request->data = $this->Batch->read(null, $id); > } > } // end edit($id = null) > > -- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > > -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Fatal Error on call to '$this->Session->setFlash'
G'day, I do not understand how I induced this error: 'Error: Call to a member function setFlash() on a non-object' which happens on any call to '$this->Session->setFlash' as noted in the default edit (or add) function below? I was adding options to the related form (option lists, labels, titles) when I broke it and have been looking for misplaced or missing closing parens, braces, brackets, or commas with no luck. This is a bare-bones data-entry app with _nothing_ extra included other than the DebugKit plugin. I did notice that even though the flash message fails the changes made by editing or adding a record _are_ correctly saved to the db and displayed in the index view when refreshed. Any hints on where to look next will be greatly appreciated. MTIA, McS public function edit($id = null) { $this->Batch->id = $id; if (!$this->Batch->exists()) { throw new NotFoundException('Invalid batch'); } if ($this->request->is('post') || $this->request->is('put')) { if ($this->Batch->save($this->request->data)) { $this->Session->setFlash('The batch has been saved'); /*this line*/ $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash('The batch could not be saved. Please, try again.'); /*this line*/ } } else { $this->request->data = $this->Batch->read(null, $id); } } // end edit($id = null) -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Session::setFlash dosn't work under chrome
*cake version:* 2.1.1 *chrome version:* 18.0.1025.142 m Latest *code to reproduce error:* put in controller action: public function testflash(){ $this->Session->setFlash("flash message will not be shown in chrome"); $this->redirect(array('action' => 'index')); } in the default layout: Session->flash(); ?> GET url /yourcontroller/testflash *detail: *the code will work as normal and show the flash message in Firefox 10 , IE6 as i tested , when using HTTP debugger like fiddler , u will notice that 'CAKEPHP' cookie is set with 302 redirect but when the redirection page is opened chrome dosn't set the cookie back! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: $this->Session->setFlash problem
if you think about it, a single "1" somewhere usually ALWAYS is some echo of a boolean value false => '' (empty string), true => '1' echo $someBooleanReturnValue; // (here we go...) On 22 Dez., 12:56, Stephen wrote: > I've been having this issue for some time! Ahah, excellent > > On 22 December 2010 07:09, sherzo wrote: > > > > > > > > > > > > > Thank you guys! yes Im using 1.2 and after I removing "echo" I'm not > > having that "1"!!! I spent hours last night to remove that 1 > > > Thanks > > Sherry > > -- > > View this message in context: > >http://cakephp.1045679.n5.nabble.com/this-Session-setFlash-problem-tp... > > Sent from the CakePHP mailing list archive at Nabble.com. > > > 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 > om>For more options, visit this group at > >http://groups.google.com/group/cake-php?hl=en > > -- > Kind Regards > Stephen @ NinjaCoderMonkey > > www.ninjacodermonkey.co.uk 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
Re: $this->Session->setFlash problem
I've been having this issue for some time! Ahah, excellent On 22 December 2010 07:09, sherzo wrote: > > Thank you guys! yes Im using 1.2 and after I removing "echo" I'm not > having that "1"!!! I spent hours last night to remove that 1 > > > Thanks > Sherry > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/this-Session-setFlash-problem-tp3314357p3314653.html > Sent from the CakePHP mailing list archive at Nabble.com. > > 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.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk 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
Re: $this->Session->setFlash problem
Thank you guys! yes Im using 1.2 and after I removing "echo" I'm not having that "1"!!! I spent hours last night to remove that 1 Thanks Sherry -- View this message in context: http://cakephp.1045679.n5.nabble.com/this-Session-setFlash-problem-tp3314357p3314653.html Sent from the CakePHP mailing list archive at Nabble.com. 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
Re: $this->Session->setFlash problem
what version are u using? sounds to me like you you use cake1.2 but this piece of code is cake1.3 style dont echo it in 1.2 $session->flash(); On 22 Dez., 02:02, Ryan Schmidt wrote: > On Dec 21, 2010, at 18:51, sherzo wrote: > > > I have the following lines in my controller: > > $this->Session->setFlash('blabla'); > > $this->redirect(array('action'=>'unsuccessful')); > > exit(); > > > and this part in my view: > > if ($session->check('Message.flash')) { > > echo $session->flash(); > > } > > > but the result will be : > > blabla1 > > > I have that 1 extra in my view!!! > > My layout has: > > echo $this->Session->flash(); > > Not sure if that makes a difference (vs. your "echo $session->flash();"). > > If not, then I suspect you have another echo somewhere else in your code > that's printing that 1. 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
Re: $this->Session->setFlash problem
On Dec 21, 2010, at 18:51, sherzo wrote: > I have the following lines in my controller: > $this->Session->setFlash('blabla'); > $this->redirect(array('action'=>'unsuccessful')); > exit(); > > and this part in my view: > if ($session->check('Message.flash')) { > echo $session->flash(); > } > > but the result will be : > blabla1 > > I have that 1 extra in my view!!! My layout has: echo $this->Session->flash(); Not sure if that makes a difference (vs. your "echo $session->flash();"). If not, then I suspect you have another echo somewhere else in your code that's printing that 1. 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
$this->Session->setFlash problem
Hi All I have the following lines in my controller: $this->Session->setFlash('blabla'); $this->redirect(array('action'=>'unsuccessful')); exit(); and this part in my view: if ($session->check('Message.flash')) { echo $session->flash(); } but the result will be : blabla1 I have that 1 extra in my view!!! can anyone help me please! Thanks Sherry -- View this message in context: http://cakephp.19694.n2.nabble.com/this-Session-setFlash-problem-tp5856173p5856173.html Sent from the CakePHP mailing list archive at Nabble.com. 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
Re: Session->setFlash error
Isn´t the ->flash a methode of 1.3 ? Do you use 1.2 core? As I know in 1.2 you have to ->setflash and a redirect... On 9 Jul., 21:51, gautam lakum wrote: > I am getting this error in my default.ctp layout. > > Notice (8): Undefined variable: session [APP\views\layouts > \default.ctp, line 74] > Code | Context > > Fatal error: Call to a member function flash() on a non-object in C: > \wamp\www\rentcar1\app\views\layouts\default.ctp on line 74 > > This is the layout html I have written. > > > flash(); ?> > > Please help. I am not getting what is happening there? 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
Re: Session->setFlash error
Thanks jeremy, it is working now. On Jul 9, 1:28 pm, Jeremy Burns | Class Outfit wrote: > If you are on 1.3, don't forget to add the Session helper and Session > component to your app_controller. > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 9 Jul 2010, at 20:51, gautam lakum wrote: > > > > > I am getting this error in my default.ctp layout. > > > Notice (8): Undefined variable: session [APP\views\layouts > > \default.ctp, line 74] > > Code | Context > > > Fatal error: Call to a member function flash() on a non-object in C: > > \wamp\www\rentcar1\app\views\layouts\default.ctp on line 74 > > > This is the layout html I have written. > > > > > flash(); ?> > > > Please help. I am not getting what is happening there? > > > 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 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
Re: Session->setFlash error
If you are on 1.3, don't forget to add the Session helper and Session component to your app_controller. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 9 Jul 2010, at 20:51, gautam lakum wrote: > I am getting this error in my default.ctp layout. > > > Notice (8): Undefined variable: session [APP\views\layouts > \default.ctp, line 74] > Code | Context > > Fatal error: Call to a member function flash() on a non-object in C: > \wamp\www\rentcar1\app\views\layouts\default.ctp on line 74 > > This is the layout html I have written. > > > flash(); ?> > > > Please help. I am not getting what is happening there? > > 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 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
Session->setFlash error
I am getting this error in my default.ctp layout. Notice (8): Undefined variable: session [APP\views\layouts \default.ctp, line 74] Code | Context Fatal error: Call to a member function flash() on a non-object in C: \wamp\www\rentcar1\app\views\layouts\default.ctp on line 74 This is the layout html I have written. flash(); ?> Please help. I am not getting what is happening there? 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
Re: Problem with Session->setFlash
What error are you getting? Can you post the code where you call it? Have you included both the Session helper and component in your controller (or app_controller)? Jeremy Burns jeremybu...@me.com On 21 May 2010, at 10:48, sami_bk wrote: > Hi Jeremy, > > Thanks for your reply. > It did not work with me , is there any other alternative to > setFlash() ? > > Greetings. > On May 20, 7:16 pm, Jeremy Burns wrote: >> Seems like overkill to me. Just use $this->Session->setFlash('Here is my >> message'); Then do echo $this->Session->flash(); - this not only displays >> your message but also clears it out of the cache. >> >> Jeremy Burns >> jeremybu...@me.com >> >> On 20 May 2010, at 18:16, sami_bk wrote: >> >> >> >>> Hi all, >> >>> I am new to CakePHP and i am building a small app. >>> i use Session->setFlash('message') to display notifications to the >>> users . >>> The notification is displayed in the default layout and i delete the >>> flash messega from the session using this code >>> >>> if ($session->check('Message.flash')) { >>>$message = $session->read('Message.flash') ; >>>if($message['message'] != '') { >>>if(is_array($message['message'])) { >>>$text = "" ; >>>foreach ($message['message'] as $mes) { >>>$text = $mes ."" ; >>>} >>>} >>>else $text = $message['message']; >>> >>> >>> >>>flash() ?> >>>} >>> } >>> >>> My problem is that notification are displayed randomly , ie : it seems >>> that the flash message is not deleted from the session. >>> PS : using another layout for ajax calls i also delete the flash >>> message in this layout. >> >>> Thanks in advance for your help >> >>> 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 >> >> 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 > > 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 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
Re: Problem with Session->setFlash
Hi Jeremy, Thanks for your reply. It did not work with me , is there any other alternative to setFlash() ? Greetings. On May 20, 7:16 pm, Jeremy Burns wrote: > Seems like overkill to me. Just use $this->Session->setFlash('Here is my > message'); Then do echo $this->Session->flash(); - this not only displays > your message but also clears it out of the cache. > > Jeremy Burns > jeremybu...@me.com > > On 20 May 2010, at 18:16, sami_bk wrote: > > > > > Hi all, > > > I am new to CakePHP and i am building a small app. > > i use Session->setFlash('message') to display notifications to the > > users . > > The notification is displayed in the default layout and i delete the > > flash messega from the session using this code > > > > if ($session->check('Message.flash')) { > > $message = $session->read('Message.flash') ; > > if($message['message'] != '') { > > if(is_array($message['message'])) { > > $text = "" ; > > foreach ($message['message'] as $mes) { > > $text = $mes ."" ; > > } > > } > > else $text = $message['message']; > > > > > > > > flash() ?> > > } > > } > > > > My problem is that notification are displayed randomly , ie : it seems > > that the flash message is not deleted from the session. > > PS : using another layout for ajax calls i also delete the flash > > message in this layout. > > > Thanks in advance for your help > > > 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 > > 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 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
Re: Problem with Session->setFlash
Seems like overkill to me. Just use $this->Session->setFlash('Here is my message'); Then do echo $this->Session->flash(); - this not only displays your message but also clears it out of the cache. Jeremy Burns jeremybu...@me.com On 20 May 2010, at 18:16, sami_bk wrote: > Hi all, > > I am new to CakePHP and i am building a small app. > i use Session->setFlash('message') to display notifications to the > users . > The notification is displayed in the default layout and i delete the > flash messega from the session using this code > > if ($session->check('Message.flash')) { >$message = $session->read('Message.flash') ; >if($message['message'] != '') { >if(is_array($message['message'])) { >$text = "" ; >foreach ($message['message'] as $mes) { >$text = $mes ."" ; >} >} >else $text = $message['message']; > > > >flash() ?> >} > } > > My problem is that notification are displayed randomly , ie : it seems > that the flash message is not deleted from the session. > PS : using another layout for ajax calls i also delete the flash > message in this layout. > > Thanks in advance for your help > > 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 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
Problem with Session->setFlash
Hi all, I am new to CakePHP and i am building a small app. i use Session->setFlash('message') to display notifications to the users . The notification is displayed in the default layout and i delete the flash messega from the session using this code if ($session->check('Message.flash')) { $message = $session->read('Message.flash') ; if($message['message'] != '') { if(is_array($message['message'])) { $text = "" ; foreach ($message['message'] as $mes) { $text = $mes ."" ; } } else $text = $message['message']; flash() ?> } } My problem is that notification are displayed randomly , ie : it seems that the flash message is not deleted from the session. PS : using another layout for ajax calls i also delete the flash message in this layout. Thanks in advance for your help 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
Re: cakephp 1.3 $this->Session->setFlash
I have changed the layout code to flash(); echo $content_for_layout; ?> and it worked perfectly. Thanks Jeremy . Johannes 2010/3/18 Jeremy Burns : > You need to do: > > echo $session->flash(); now. > > Jeremy Burns > jeremybu...@me.com > > On 18 Mar 2010, at 13:06, Johannes Goll wrote: > >> Hi, >> >> I am migrating from 1.2 to cakephp 1.3 and am trying to >> switch to the new $this->Session->setFlash functionality that >> uses elements: >> >> Projects Controller: >> function edit($id = null) { >> ... >> $this->Session->setFlash('The Project has been saved','message'); >> $this->redirect(array('action'=>'index')); >> ... >> } >> >> Layout: >> >> > >> $session->flash(); >> >> echo $content_for_layout; >> ?> >> >> >> Element; >> >> >> > echo $message; >> ?> >> >> >> No message is shown on the Projects index page after executing the >> edit action of the controller. >> But when I do a die($message) inside the element, the message is displayed. >> >> What am I doing wrong here? >> >> Thanks, >> Johannes >> >> 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 > > 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 -- Johannes Goll 211 Curry Ford Lane Gaithersburg, Maryland 20878 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
Re: cakephp 1.3 $this->Session->setFlash
You need to do: echo $session->flash(); now. Jeremy Burns jeremybu...@me.com On 18 Mar 2010, at 13:06, Johannes Goll wrote: > Hi, > > I am migrating from 1.2 to cakephp 1.3 and am trying to > switch to the new $this->Session->setFlash functionality that > uses elements: > > Projects Controller: > function edit($id = null) { > ... > $this->Session->setFlash('The Project has been saved','message'); > $this->redirect(array('action'=>'index')); > ... > } > > Layout: > > > $session->flash(); > > echo $content_for_layout; > ?> > > > Element; > > > echo $message; > ?> > > > No message is shown on the Projects index page after executing the > edit action of the controller. > But when I do a die($message) inside the element, the message is displayed. > > What am I doing wrong here? > > Thanks, > Johannes > > 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 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
cakephp 1.3 $this->Session->setFlash
Hi, I am migrating from 1.2 to cakephp 1.3 and am trying to switch to the new $this->Session->setFlash functionality that uses elements: Projects Controller: function edit($id = null) { ... $this->Session->setFlash('The Project has been saved','message'); $this->redirect(array('action'=>'index')); ... } Layout: flash(); echo $content_for_layout; ?> Element; No message is shown on the Projects index page after executing the edit action of the controller. But when I do a die($message) inside the element, the message is displayed. What am I doing wrong here? Thanks, Johannes 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
Re: $this->Session->setFlash();
I use this to make it lots shorter: $this->Session->setFlash(___('Success Message'), 'flashes/success'); In app/views/layouts/flashes I have P.s. in app/config/boostrap.php I have function ___($string) { return __($string, true); } 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
RE: $this->Session->setFlash();
Thanks, I found it in the cookbook right after I sent the message but thanks for your time! Happy New Year. Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Jeremy Burns Sent: January-02-10 12:50 AM To: CakePHP Subject: Re: $this->Session->setFlash(); Hi Dave Here's how you can do it: $this->Session->setFlash(__('Your message.', true), true, array ('class' => 'yourClass')); On Jan 2, 2:35 am, "Dave" wrote: > I was wondering is there a way to add a class to the session from the > controller? > > The setflash as far as i can see is used for alerting user after a > save attempt so > > $this->Session->setFlash(__('Information Updated.', true)); > > or > > $this->Session->setFlash(__('Error! Please try again.', true)); > > So the idea would be for the success message add a class so the > message text is green if failed text is red. > > Any way this can be done? > > Dave 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 cake-php+at http://groups.google.com/group/cake-php?hl=en No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.123/2595 - Release Date: 01/01/10 05:50:00 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
Re: $this->Session->setFlash();
Hi Dave Here's how you can do it: $this->Session->setFlash(__('Your message.', true), true, array ('class' => 'yourClass')); On Jan 2, 2:35 am, "Dave" wrote: > I was wondering is there a way to add a class to the session from the > controller? > > The setflash as far as i can see is used for alerting user after a save > attempt so > > $this->Session->setFlash(__('Information Updated.', true)); > > or > > $this->Session->setFlash(__('Error! Please try again.', true)); > > So the idea would be for the success message add a class so the message text > is green if failed text is red. > > Any way this can be done? > > Dave 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
$this->Session->setFlash();
I was wondering is there a way to add a class to the session from the controller? The setflash as far as i can see is used for alerting user after a save attempt so $this->Session->setFlash(__('Information Updated.', true)); or $this->Session->setFlash(__('Error! Please try again.', true)); So the idea would be for the success message add a class so the message text is green if failed text is red. Any way this can be done? Dave 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
Re: Session setFlash is not working on Firefox 3.5.3
Reinstalled FF, works perfectly. -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-...@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=.
Re: Session setFlash is not working on Firefox 3.5.3
@John: You are mistaken. First, if that were the case, flashes wouldn't work in all the other browser which the OP clearly stated it does, and secondly, the entire point of flash is to pass a message to the user through a redirect. I use them all the time and they work perfectly well through redirects. To the OP, it works fine in Firefox 3.5.4 for me, Cent OS server, PHP 5.2.9. Is it just Firefox 3.5.3? Have you tried installing the latest version of firefox in a VM (or somewhere) to repeat the result? Nick On Nov 5, 3:33 am, John Andersen wrote: > $this->redirect closes the existing session and thus your flash > message is not passed on! > > See the Controller api > athttp://api.cakephp.org/view_source/controller/#line-536 > > Enjoy, > John > > On Nov 5, 12:12 pm, Octavian wrote: > > > Same configuration & same problems too... > > > On 9 okt, 23:56, Franco Bonazza wrote: > > > > Sorry, Cake is 1.2.5, server is Apache 2.2 running on windows, and PHP > > > is 5.2. > > > > Don't know if it's relevant. > > > > On 9 oct, 17:12, Franco Bonazza wrote: > > > > > Hello, > > > > > Here's my problem > > > > > Something this simple: > > > > > // controller > > > > > Class ExsController extends AppController{ > > > > public function list(){ > > > > $this->Session->setFlash('Hello'); > > > > $this->redirect('/exs/new',null,true); // or redirect + die()} > > > > > public function new(){} > > > > > } > > > > > // view layout > > > > > flash() ?> > > > > > Doesn't work at all when I'm using Firefox. It works in opera 10, ie8, > > > > safari and chrome. > > > > Session is working, if I write something manually I can see it in > > > > firefox. I can even see that at some point the message was put in > > > > session because if I print the session I see the empty message array. > > > > If I take out the redirect it shows the message in that page even in > > > > firefox, somehow it gets wiped. As if the script would have continued > > > > after the redirect... but only in firefox, wich just flips me out. It > > > > can't be catching a template, I can't imagine that... Anyone has a > > > > clue about what's happening here? > > > > > This happened in a big project but I reduced to something as simple as > > > > what I pasted and the problem persists. > > > > > I hope someone at least tries this and tells me it works for them, > > > > just to know if I have some weird configuration on browser or server, > > > > or this really doesn't work. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Session setFlash is not working on Firefox 3.5.3
Sorry, Cake is 1.2.5, server is Apache 2.2 running on windows, and PHP is 5.2. Don't know if it's relevant. On 9 oct, 17:12, Franco Bonazza wrote: > Hello, > > Here's my problem > > Something this simple: > > // controller > > Class ExsController extends AppController{ > public function list(){ > $this->Session->setFlash('Hello'); > $this->redirect('/exs/new',null,true); // or redirect + die()} > > public function new(){} > > } > > // view layout > > flash() ?> > > Doesn't work at all when I'm using Firefox. It works in opera 10, ie8, > safari and chrome. > Session is working, if I write something manually I can see it in > firefox. I can even see that at some point the message was put in > session because if I print the session I see the empty message array. > If I take out the redirect it shows the message in that page even in > firefox, somehow it gets wiped. As if the script would have continued > after the redirect... but only in firefox, wich just flips me out. It > can't be catching a template, I can't imagine that... Anyone has a > clue about what's happening here? > > This happened in a big project but I reduced to something as simple as > what I pasted and the problem persists. > > I hope someone at least tries this and tells me it works for them, > just to know if I have some weird configuration on browser or server, > or this really doesn't work. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Session setFlash is not working on Firefox 3.5.3
Hello, Here's my problem Something this simple: // controller Class ExsController extends AppController{ public function list(){ $this->Session->setFlash('Hello'); $this->redirect('/exs/new',null,true); // or redirect + die() } public function new(){} } // view layout flash() ?> Doesn't work at all when I'm using Firefox. It works in opera 10, ie8, safari and chrome. Session is working, if I write something manually I can see it in firefox. I can even see that at some point the message was put in session because if I print the session I see the empty message array. If I take out the redirect it shows the message in that page even in firefox, somehow it gets wiped. As if the script would have continued after the redirect... but only in firefox, wich just flips me out. It can't be catching a template, I can't imagine that... Anyone has a clue about what's happening here? This happened in a big project but I reduced to something as simple as what I pasted and the problem persists. I hope someone at least tries this and tells me it works for them, just to know if I have some weird configuration on browser or server, or this really doesn't work. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Session->setFlash() params not working ??
Hi All, I am trying to change the class attribute for my flash message by writing this in my controller: $this->Session->setFlash($errMsg, 'default', array('class' => 'errormsg')); AND I GET THE DEFAULT IN MY VIEW: My view is not cached because changing the message itself works or using a key param works as well. Any ideas what's wrong or how I may debug this? Thanks, Spence --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: related to Session->setFlash
Sorry for the late reply.Yes, you are right, if you are doing it in views/layouts/default.ctp On Aug 21, 6:53 am, kdubya wrote: > On Aug 19, 9:01 am, zaboo wrote: > > > Don't echo $this->Session->setFlash() > > > On Aug 19, 8:27 am, Chander Bhan wrote: > > > > I always get the digit 1 in the next line of the message sent through > > > Session->setFlash from controller, need help > > I don't understand this answer. I have been having the same problem > (the number 1 being displayed on the line after the flash message). > Here is the code snippet from my controller: > > function edit($id = null) { > $this->set('schema', $this->Item->_schema); > if (!$id && empty($this->data)) { > $this->Session->setFlash(__('Invalid Item', true)); > $this->redirect(array('action'=>'index')); > } > > And here is the code from the view: > > flash();?> > > Are you saying that in the view the code should be: > > flash();?> > > Is that correct? > > Thanks, > Ken --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: related to Session->setFlash
Yes. On Aug 21, 8:53 am, kdubya wrote: > On Aug 19, 9:01 am, zaboo wrote: > > > Don't echo $this->Session->setFlash() > > > On Aug 19, 8:27 am, Chander Bhan wrote: > > > > I always get the digit 1 in the next line of the message sent through > > > Session->setFlash from controller, need help > > I don't understand this answer. I have been having the same problem > (the number 1 being displayed on the line after the flash message). > Here is the code snippet from my controller: > > function edit($id = null) { > $this->set('schema', $this->Item->_schema); > if (!$id && empty($this->data)) { > $this->Session->setFlash(__('Invalid Item', true)); > $this->redirect(array('action'=>'index')); > } > > And here is the code from the view: > > flash();?> > > Are you saying that in the view the code should be: > > flash();?> > > Is that correct? > > Thanks, > Ken --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: related to Session->setFlash
On Aug 19, 9:01 am, zaboo wrote: > Don't echo $this->Session->setFlash() > > On Aug 19, 8:27 am, Chander Bhan wrote: > > > I always get the digit 1 in the next line of the message sent through > > Session->setFlash from controller, need help I don't understand this answer. I have been having the same problem (the number 1 being displayed on the line after the flash message). Here is the code snippet from my controller: function edit($id = null) { $this->set('schema', $this->Item->_schema); if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid Item', true)); $this->redirect(array('action'=>'index')); } And here is the code from the view: flash();?> Are you saying that in the view the code should be: flash();?> Is that correct? Thanks, Ken --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: related to Session->setFlash
thanks a lot for helping. On Aug 19, 6:01 pm, zaboo wrote: > Don't echo $this->Session->setFlash() > > On Aug 19, 8:27 am, Chander Bhan wrote: > > > I always get the digit 1 in the next line of the message sent through > > Session->setFlash from controller, need help --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: related to Session->setFlash
Yes, i was doing exactly the same,in views/layouts/default.ctp file of my application.thanks a lot for help On Aug 19, 7:02 pm, Marcelo Andrade wrote: > On Wed, Aug 19, 2009 at 9:27 AM, Chander Bhan wrote: > > > I always get the digit 1 in the next line of the message sent through > > Session->setFlash from controller, need help > > Are you echoing the Session->setFlash() call from the controller? > > Best regards. > > -- > MARCELO DE F. ANDRADE > Belem, PA, Amazonia, Brazil > Linux User #221105 > > http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: related to Session->setFlash
Don't echo $this->Session->setFlash() On Aug 19, 8:27 am, Chander Bhan wrote: > I always get the digit 1 in the next line of the message sent through > Session->setFlash from controller, need help --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: related to Session->setFlash
On Wed, Aug 19, 2009 at 9:27 AM, Chander Bhan wrote: > > I always get the digit 1 in the next line of the message sent through > Session->setFlash from controller, need help Are you echoing the Session->setFlash() call from the controller? Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
related to Session->setFlash
I always get the digit 1 in the next line of the message sent through Session->setFlash from controller, need help --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with $this->Session->setFlash when using caching
thanks for the replies Marcel, sounds like sort of the same problem. strange thing is that the flash message does work when i do not specify a custom layout in setFlash... but then I can not have the nice effect of removing the flash message after few seconds. On Jun 17, 11:45 pm, Marcel wrote: > Steve wrote: > > Well, when I activate this line in core.php: > > > Configure::write('Cache.disable', true); > > > Everything works like expected.. > > > But then you have no caching at all... > > See:https://trac.cakephp.org/ticket/6034 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with $this->Session->setFlash when using caching
Steve wrote: > Well, when I activate this line in core.php: > > Configure::write('Cache.disable', true); > > Everything works like expected.. > > But then you have no caching at all... See: https://trac.cakephp.org/ticket/6034 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with $this->Session->setFlash when using caching
Well, when I activate this line in core.php: Configure::write('Cache.disable', true); Everything works like expected.. But then you have no caching at all... On Jun 17, 3:00 pm, Marcel wrote: > Looks like that this is also not working within nocache, like the > FormHelper... :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with $this->Session->setFlash when using caching
Looks like that this is also not working within nocache, like the FormHelper... :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with $this->Session->setFlash when using caching
Hello everybody, I have a problem with some cakephp (version 1.2.3.8166) code. It concerns using $this->Session->setFlash in a controller action. Part of the controller code: $this->Session->setFlash(__('Everything fine.', true), 'flashinfo'); $this->redirect(array('controller'=>'users','action'=>'index')); As you can see I use a custom layout for the Flash message called 'flashinfo': <!-- Flash.show('flashInfoMessage'); //--> code for the javascript Flash class: Flash={ show:function(element){ $(element).visualEffect('appear'); this.timer=setTimeout('Flash.hide("'+element+'")',7000); }, hide:function(element){ $(element).visualEffect('fade'); clearTimeout(this.timer); return false; } }; What this does is show the flash message for 7 seconds after which it will be hidden by using the nice scriptaculous effect Fade. I have two of these layouts, one for informational messages (green background) and one for errors (red background). This all works perfectly fine as long as I do not use cake view caching. But of course I want to have caching in the site for speed. To render the flash message I placed this into the layout (default.ctp): flash(); ?> With caching turned on and a cached version of the page being rendered already present in the cache, this generates the following error as soon as the redirect is performed and the specified URL in the redirect is being rendered: Notice (8): Trying to get property of non-object [CORE/cake_1.2.3.8166/ libs/view/helpers/session.php, line 145] Code | Context $key= "flash" $flash = array( "message" => "Uw contactformulier is verzonden.", "layout" => "flashinfo", "params" => array() ) $view = false } else { $view =& ClassRegistry::getObject('view'); list($tmpLayout, $tmpVars, $tmpTitle) = array ($view->layout, $view->viewVars, $view->pageTitle); SessionHelper::flash() - CORE/cake_1.2.3.8166/libs/view/helpers/ session.php, line 145 include - APP/tmp/cache/views/home.php, line 72 View::renderCache() - CORE/cake_1.2.3.8166/libs/view/view.php, line 495 Dispatcher::cached() - CORE/cake_1.2.3.8166/dispatcher.php, line 678 Dispatcher::dispatch() - CORE/cake_1.2.3.8166/dispatcher.php, line 123 [main] - APP/webroot/index.php, line 88 Fatal error: Call to undefined method stdClass::renderLayout() in /usr/ www/htdocs/afvalcontainer/cake_1.2.3.8166/libs/view/helpers/ session.php on line 147 The error does not occur on first time rendering of the page, everything works as expected in that case. Also when caching is globally turned off, everything works as expected. Any ideas of what I am doing wrong ? Or is this a bug ? Happy caking, Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with $this->Session->setFlash(__('Hidden value changed'));
__()function is using Localization & Internationalization if u want the __()function $this->Session->setFlash(__('Hidden value changed',true));otherwise $this->Session->setFlash('Hidden value changed');On Tue, Apr 7, 2009 at 5:11 PM, Toby wrote: > > Morning all, > > I have a problem with the following line in my code... > > $this->Session->setFlash(__('Hidden value changed')); > > It is printing the translated 'Hidden value changed' to the screen > rather than setting the flash message. If I remove the __() function > it works fine. > > I can do this for this site as it is not an international site, > however it irks me when things don't work as they should so could > anyone shed some light on this problem? > > I haven't written this code but copied it from a blog post I found > online, so it's not even something I have got wrong. > > Any help appreciated. > > Toby > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with $this->Session->setFlash(__('Hidden value changed'));
Sorry. Please ignore this message. Searched for ages for the answer & only found it after posting this message... typical. I have just found that the _() function prints the translation by default. By adding the 2nd parameter of true then the output is returned instead. T On Apr 7, 12:41 pm, Toby wrote: > Morning all, > > I have a problem with the following line in my code... > > $this->Session->setFlash(__('Hidden value changed')); > > It is printing the translated 'Hidden value changed' to the screen > rather than setting the flash message. If I remove the __() function > it works fine. > > I can do this for this site as it is not an international site, > however it irks me when things don't work as they should so could > anyone shed some light on this problem? > > I haven't written this code but copied it from a blog post I found > online, so it's not even something I have got wrong. > > Any help appreciated. > > Toby --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with $this->Session->setFlash(__('Hidden value changed'));
Hi, Toby wrote: > I have a problem with the following line in my code... > > $this->Session->setFlash(__('Hidden value changed')); try this: $this->Session->setFlash(__('Hidden value changed', true)); http://api.cakephp.org/file/basics.php#function-__ Regards Guenther --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with $this->Session->setFlash(__('Hidden value changed'));
Morning all, I have a problem with the following line in my code... $this->Session->setFlash(__('Hidden value changed')); It is printing the translated 'Hidden value changed' to the screen rather than setting the flash message. If I remove the __() function it works fine. I can do this for this site as it is not an international site, however it irks me when things don't work as they should so could anyone shed some light on this problem? I haven't written this code but copied it from a blog post I found online, so it's not even something I have got wrong. Any help appreciated. Toby --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Session - setFlash - redirect - GONE!
Hello All, I'm having an issue pretty much exactly like the issue posted here: http://www.nabble.com/Sessions,-redirects-and-setFlash-td14792737.html Basically I set a session variable when an admin logs in with some info $this->Session->write('AdminInfo', $admin); And then on every page in the admin area I check if that session variable is still valid or if it's expired using: public function beforeFilter() { $this->checkLogin(); } public function checkLogin() { if ($this->Session->check('AdminInfo') === false) { // Save the URL of where you want to go. $this->Session->setFlash('You must login to view this area.'); $this->Session->write('RedirectURL', Router::url('', false)); $this->redirect('/admin/login/'); } } Now the problem is that after the redirect back to the login screen all my session info is gone. Neither the RedirectURL nor the setFlash message exist upon returning to the login page. All I see in the session is the userAgent, rand, timeout, etc. This only happens if the session existed beforehand and not when you try to go to a page fresh before every logging in. As a flow example: 1. Not Logged In - Go to admin area page - Redirect to login - Redirect URL and setFlash both work 2. Logged In - Go to admin area page - session has timed out - Redirect to login - Redirect URL and setFlash both gone now. At no point in my code do I ever delete the session variables or sesion itself. This is only happening when the session times out on its own. Does anyone have a solution or know whats going on here? I've spent hours trying to figure this out and the thread above didn't really offer a solution since I don't use the DAuth component. Any help would be greatly appreciated. Thanks. -- View this message in context: http://www.nabble.com/Session---setFlash---redirect---GONE%21-tp21485684p21485684.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Session->setFlash()
Excerpt from Frequently Asked Questions in this group... Number displayed under flash messages * Don't use echo - Tarique Maybe that gives a clue? On Feb 17, 8:01 am, herc <[EMAIL PROTECTED]> wrote: > I can't remove number 1. That is a problem. > > On Feb 16, 8:46 pm, Baz <[EMAIL PROTECTED]> wrote: > > > Because that's what setFlash does??? > > > On Feb 16, 2008 10:04 AM, Samuel DeVore <[EMAIL PROTECTED]> wrote: > > > > wow you echoed again ;) > > > > On Feb 16, 2008 7:20 AM, herc <[EMAIL PROTECTED]> wrote: > > > > > Any idea why my $this->Session->setFlash('foo'); outputs Foo 1 in my > > > > view? :) > > > > CODE: > > > > foo1 > > > > -- > > > -- > > > (the old fart) the advice is free, the lack of crankiness will cost you > > > > - its a fine line between a real question and an idiot > > > >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > > >http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > > >http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Session->setFlash()
I can't remove number 1. That is a problem. On Feb 16, 8:46 pm, Baz <[EMAIL PROTECTED]> wrote: > Because that's what setFlash does??? > > On Feb 16, 2008 10:04 AM, Samuel DeVore <[EMAIL PROTECTED]> wrote: > > > > > wow you echoed again ;) > > > On Feb 16, 2008 7:20 AM, herc <[EMAIL PROTECTED]> wrote: > > > > Any idea why my $this->Session->setFlash('foo'); outputs Foo 1 in my > > > view? :) > > > CODE: > > > foo1 > > > -- > > -- > > (the old fart) the advice is free, the lack of crankiness will cost you > > > - its a fine line between a real question and an idiot > > >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ > >http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ > >http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Session->setFlash()
wow you echoed again ;) On Feb 16, 2008 7:20 AM, herc <[EMAIL PROTECTED]> wrote: > > Any idea why my $this->Session->setFlash('foo'); outputs Foo 1 in my > view? :) > CODE: > foo1 > > > > -- -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Session->setFlash()
Any idea why my $this->Session->setFlash('foo'); outputs Foo 1 in my view? :) CODE: foo1 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Can I use Session::setFlash from model?
On Jan 22, 10:57 pm, powtac <[EMAIL PROTECTED]> wrote: > But what can I do when Im using beforeFind()? I dont call this > function in my controller, it is called automatically. Don't. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Can I use Session::setFlash from model?
But what can I do when Im using beforeFind()? I dont call this function in my controller, it is called automatically. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Can I use Session::setFlash from model?
Or you can pass the Session component to your model function as parameter, so that you can access this component from there, In your Controller, $this->YourModelName->yourModelFunction($this->session) And in your Model function function yourModelFunction($session) { $session->setFlash('blah blah blah...'); } But better you use the component from your Controller. On Jan 6, 2008 4:51 PM, AD7six <[EMAIL PROTECTED]> wrote: > > > > On Jan 5, 6:21 pm, MikeK <[EMAIL PROTECTED]> wrote: > > I moved some code from a controller to the model, and the code set > > some flash error msgs using the session component setFlash call. > > > > I didn't realize it wasn't working until someone triggered the error > > today -- is there any way to make that work or do I need to > > restructure the interface to the routine? > > You cannot use the session component from a model - return a value > that your controller uses to act on. > > hth, > > AD > > > > -- Thanks Anupom Trippert Inc. [http://www.trippert.com] GopherNow. [http://www.gophernow.com/] Homepage. [http://www.anupom.wordpress.com/] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Can I use Session::setFlash from model?
On Jan 5, 6:21 pm, MikeK <[EMAIL PROTECTED]> wrote: > I moved some code from a controller to the model, and the code set > some flash error msgs using the session component setFlash call. > > I didn't realize it wasn't working until someone triggered the error > today -- is there any way to make that work or do I need to > restructure the interface to the routine? You cannot use the session component from a model - return a value that your controller uses to act on. hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Can I use Session::setFlash from model?
According to both APIs (1.1.19 and 1.2) the Session helper supports a write() method - but both APIs also say "This method should not be used in a view". :) On Jan 5, 11:21 am, MikeK <[EMAIL PROTECTED]> wrote: > I moved some code from a controller to the model, and the code set > some flash error msgs using the session component setFlash call. > > I didn't realize it wasn't working until someone triggered the error > today -- is there any way to make that work or do I need to > restructure the interface to the routine? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Can I use Session::setFlash from model?
I moved some code from a controller to the model, and the code set some flash error msgs using the session component setFlash call. I didn't realize it wasn't working until someone triggered the error today -- is there any way to make that work or do I need to restructure the interface to the routine? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: $this->Session->setFlash(' -- msg here -- '); not showing up on 1.2.x
Thanks a lot everyone! On Dec 11, 2007 12:13 AM, daphonz <[EMAIL PROTECTED]> wrote: > > Also make sure you have something in your view to display the message: > > if($session->check('Message.flash')): >$session->flash(); >endif; > ?> > > Or the like. > > -Casey > > On Dec 9, 10:44 pm, "Louie Miranda" <[EMAIL PROTECTED]> wrote: > > Got this working.. > > > > Just add.. > > > > $this->Session->setFlash('Sorry, the information you\'ve > > entered is incorrect.'); > > $this->redirect('login'); > > > > *$this->redirect('login');* > > > > So, there will be no blank page. And the flash message will be shown on > the > > login() > > > > Louie > > > > On Dec 10, 2007 8:51 AM, Louie Miranda <[EMAIL PROTECTED]> wrote: > > > > > > > > > Guys, > > > > > this is fairly simple setFlash. But, i wonder why it is now showing > up? > > > > > A few of my simple auth codes.. > > > > > class UsersController extends AppController > > > { > > > var $name = "Users"; > > > var $helpers = array('Html', 'Form', 'Session'); > > > > > > > > > > function login() > > > { > > > if(empty($this->data) == false) > > > { > > > if(($user = > $this->User->validateLogin($this->data['User'])) > > > == true) > > > { > > > $this->Session->write('User', $user); > > > $this->Session->setFlash('You\'ve successfully logged > > > in.'); > > > $this->redirect('/statistics/display'); > > > exit(); > > > } > > > else > > > { > > > $this->Session->setFlash('Sorry, the information > you\'ve > > > entered is incorrect.'); > > > exit(); > > > } > > > } > > > } > > > ... > > > ?> > > > > > I can successfully login, and it redirects right away. But, i could > not > > > see the flash message. Did, i missed something here? > > > I am using the latest 1.2.x (pre-beta) > > > > > Please help! > > > > > -- > > > Louie Miranda ([EMAIL PROTECTED]) > > >http://www.axishift.com > > > > > Security Is A Series Of Well-Defined Steps > > > chmod -R 0 / ; and smile :) > > > > -- > > Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com > > > > Security Is A Series Of Well-Defined Steps > > chmod -R 0 / ; and smile :) > > > > -- Louie Miranda ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: $this->Session->setFlash(' -- msg here -- '); not showing up on 1.2.x
Also make sure you have something in your view to display the message: check('Message.flash')): $session->flash(); endif; ?> Or the like. -Casey On Dec 9, 10:44 pm, "Louie Miranda" <[EMAIL PROTECTED]> wrote: > Got this working.. > > Just add.. > > $this->Session->setFlash('Sorry, the information you\'ve > entered is incorrect.'); > $this->redirect('login'); > > *$this->redirect('login');* > > So, there will be no blank page. And the flash message will be shown on the > login() > > Louie > > On Dec 10, 2007 8:51 AM, Louie Miranda <[EMAIL PROTECTED]> wrote: > > > > > Guys, > > > this is fairly simple setFlash. But, i wonder why it is now showing up? > > > A few of my simple auth codes.. > > > class UsersController extends AppController > > { > > var $name = "Users"; > > var $helpers = array('Html', 'Form', 'Session'); > > > > > > function login() > > { > > if(empty($this->data) == false) > > { > > if(($user = $this->User->validateLogin($this->data['User'])) > > == true) > > { > > $this->Session->write('User', $user); > > $this->Session->setFlash('You\'ve successfully logged > > in.'); > > $this->redirect('/statistics/display'); > > exit(); > > } > > else > > { > > $this->Session->setFlash('Sorry, the information you\'ve > > entered is incorrect.'); > > exit(); > > } > > } > > } > > ... > > ?> > > > I can successfully login, and it redirects right away. But, i could not > > see the flash message. Did, i missed something here? > > I am using the latest 1.2.x (pre-beta) > > > Please help! > > > -- > > Louie Miranda ([EMAIL PROTECTED]) > >http://www.axishift.com > > > Security Is A Series Of Well-Defined Steps > > chmod -R 0 / ; and smile :) > > -- > Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com > > Security Is A Series Of Well-Defined Steps > chmod -R 0 / ; and smile :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: $this->Session->setFlash(' -- msg here -- '); not showing up on 1.2.x
Got this working.. Just add.. $this->Session->setFlash('Sorry, the information you\'ve entered is incorrect.'); $this->redirect('login'); *$this->redirect('login');* So, there will be no blank page. And the flash message will be shown on the login() Louie On Dec 10, 2007 8:51 AM, Louie Miranda <[EMAIL PROTECTED]> wrote: > Guys, > > this is fairly simple setFlash. But, i wonder why it is now showing up? > > A few of my simple auth codes.. > class UsersController extends AppController > { > var $name = "Users"; > var $helpers = array('Html', 'Form', 'Session'); > > > > function login() > { > if(empty($this->data) == false) > { > if(($user = $this->User->validateLogin($this->data['User'])) > == true) > { > $this->Session->write('User', $user); > $this->Session->setFlash('You\'ve successfully logged > in.'); > $this->redirect('/statistics/display'); > exit(); > } > else > { > $this->Session->setFlash('Sorry, the information you\'ve > entered is incorrect.'); > exit(); > } > } > } > ... > ?> > > I can successfully login, and it redirects right away. But, i could not > see the flash message. Did, i missed something here? > I am using the latest 1.2.x (pre-beta) > > Please help! > > -- > Louie Miranda ([EMAIL PROTECTED]) > http://www.axishift.com > > Security Is A Series Of Well-Defined Steps > chmod -R 0 / ; and smile :) -- Louie Miranda ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
$this->Session->setFlash(' -- msg here -- '); not showing up on 1.2.x
Guys, this is fairly simple setFlash. But, i wonder why it is now showing up? A few of my simple auth codes.. data) == false) { if(($user = $this->User->validateLogin($this->data['User'])) == true) { $this->Session->write('User', $user); $this->Session->setFlash('You\'ve successfully logged in.'); $this->redirect('/statistics/display'); exit(); } else { $this->Session->setFlash('Sorry, the information you\'ve entered is incorrect.'); exit(); } } } ... ?> I can successfully login, and it redirects right away. But, i could not see the flash message. Did, i missed something here? I am using the latest 1.2.x (pre-beta) Please help! -- Louie Miranda ([EMAIL PROTECTED]) http://www.axishift.com Security Is A Series Of Well-Defined Steps chmod -R 0 / ; and smile :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Problems with $this->Session->setFlash in layout
Hi There, I was having the same problem and ive been doing some digging throught the API. It seems that $this->Session->flash() is deprecated and you should use $session->flash() in your views instead. Hope this helps you! On Apr 26, 12:34 am, NewToCakePHP <[EMAIL PROTECTED]> wrote: > Hi everyone. As you can see by my handles name I am new to cakePHP so > please bear with me. OK I seem to be having problems with the > $this->Session->setFlash. I basically am following what was recommended in > > this link ->http://bakery.cakephp.org/articles/view/flashing-with-cakephp > but > its not working. Instead it outputs "Array" which seems to be coming > from the statement $this->controller->Session->flash(). > > The relevantcontrollerportion > of the code is > if ($this->User->save($this->data)) > { > $this->Session->setFlash('Your post has been saved.'); > $this->redirect('/users/temp'); > exit(); > } > $this->Session->setFlash('An Error has occured'); > $this->redirect('/users/add'); > exit(); > > I also have javascript enabled of course and am using a very recent > version of firefox. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Problems with $this->Session->setFlash in layout
Hi everyone. As you can see by my handles name I am new to cakePHP so please bear with me. OK I seem to be having problems with the $this- >Session->setFlash. I basically am following what was recommended in this link -> http://bakery.cakephp.org/articles/view/flashing-with-cakephp but its not working. Instead it outputs "Array" which seems to be coming from the statement $this->controller->Session->flash(). The relevant controller portion of the code is if ($this->User->save($this->data)) { $this->Session->setFlash('Your post has been saved.'); $this->redirect('/users/temp'); exit(); } $this->Session->setFlash('An Error has occured'); $this->redirect('/users/add'); exit(); I also have javascript enabled of course and am using a very recent version of firefox. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Session->setFlash() with layout fails
i have a similar problem, i want to have *all* system messages (incl. form validation errors) in views displayed in JS popups instead of html rendering. does anybody know a smart way to accomplish this ? thanks ! jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Session->setFlash() with layout fails
Nobody an idea? On 23 Mrz., 23:11, "Preloader" <[EMAIL PROTECTED]> wrote: > Ah of course: I'm using Cake 1.2.x.x_22.03.2007 > > :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Session->setFlash() with layout fails
Ah of course: I'm using Cake 1.2.x.x_22.03.2007 :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Session->setFlash() with layout fails
Hello Bakers, I have problems using Session::setFlash in the right way. Here is a very simplified version of my AppController. class AppController extends Controller { var $helpers = array('Html', 'Form'); var $components = array('Session'); function beforeFilter() { $this->Session->setFlash('This is an error!','my_error_layout'); } } This brings me the following errors: Notice (8): Undefined property: SessionComponent::$here [CORE\cake \libs\controller\components\session.php, line 191] Notice (8): Undefined property: SessionComponent::$params [CORE\cake \libs\controller\components\session.php, line 192] Notice (8): Undefined property: SessionComponent::$action [CORE\cake \libs\controller\components\session.php, line 193] Notice (8): Undefined property: SessionComponent::$data [CORE\cake \libs\controller\components\session.php, line 194] Notice (8): Undefined property: SessionComponent::$plugin [CORE\cake \libs\controller\components\session.php, line 196] The problem only occurs when setting a layout ('my_error_layout'), without a layout for the flash message it seems to work. Am I doing something wrong? Any ideas? Thanks, Christoph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Problama com a função Session->setflash no I.E. Preciso de ajuda!!!
On Feb 18, 6:55 pm, "Guga" <[EMAIL PROTECTED]> wrote: > Salve, salve galera!!! Eu estou começando a aprender como utilizar o > cake e estou com algumas dúvidas espero que vc´s possam me ajudar. > > Resumo: Estou com um probleminha. Quando eu utilizo a função > $this->Session->setFlash("Mensagem"); especificamente no Internet Explorer I bet the problem is nothing to do with flash and everything to do with Internet explorer having no session continuity. http://groups.google.com/group/cake-php/search?group=cake-php&q=session+problem+IE&qt_g=Search+this+group http://groups.google.com/group/cake-php/search?group=cake-php&q=+Session+weirdness+with+IE HTH, AD7six Ps I see you found Cakephp-pt - Please write here only in english (use an automatic translator if nothing else) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Problama com a função Session->setflash no I.E. Preciso de ajuda!!!
You shouldn't post your questions in any other language than English. If you stick your posts to English everybody will be able to understand what you say and help you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Problama com a função Session->setflash no I.E. Preciso de ajuda!!!
Sorry, I can't understand your problem. Maybe it's better to post the problem with English language -- http://riky.kurniawan.us On 2/19/07, Guga <[EMAIL PROTECTED]> wrote: > > > Salve, salve galera!!! Eu estou começando a aprender como utilizar o > cake e estou com algumas dúvidas espero que vc´s possam me ajudar. > > Resumo: Estou com um probleminha. Quando eu utilizo a função $this- > >Session->setFlash("Mensagem"); especificamente no Internet Explorer > através da função beforeFilter() em um dos meus controles ela não é > mostrada na tela logo de primeira, para eu isso aconteça eu tenho que > dá um refresh, porém como eu disse isso só acontece com o IE. No opera > e no Firefox a mesagem é exibida assim a página é carregada. > > O problema da íntegra: > > Criei um beforeFilter com a seguinte função no arquivo > "modulos_controller.php": > > function beforeFilter() > { > $this->checkSession(); > } > > Esta função possui o seguinte cógido: > > function checkSession() > { > if (!$this->Session->check("usuario")) > { > $this->Session->setFlash("Mensagem",null); > $this->redirect("/"); > exit; > } > } > > Ou seja, antes que o php interprete o conteúdo do arquivo > "modulos_controller.php" ele checa a sessão para saber se o usuário já > efetuou o login. Caso ele não o tenha feito ele será redirecionado > para a página raiz e guardará a mensagem com a função setFlash. > > Na minha página raiz, index.php, a seguinte função é executada: > > if ($session->check('Message.flash')) > { > $session->flash(); > } > > Nesta página o componente Session verifica se existe alguma mensagem > com o ID = flash e caso seja verdade ele imprime esta mensagem na > tela. > > Só relebrando eu estou começando a utilizar o cake tem pouco tempo, > então pode ter alguma coisa que eu falei que não seja verdade, porém > eu tô mostrando como eu entendi. Continuando... > > No Opera e no Firefox, simplesmente funciona, perfeitamente. Mas, no > bendito Intenet Explorer eu preciso dá um refresh na tela após seu > redirecionamento para que esta mensagem seja mostrada. > > Fiz um outro teste, coloque a mesma função setFlash e o > redirecionamento direto no controller de autenticação do usuário > "security/login" e fiz o redirecionamento, funcionou em todos os > browser acho que o problema deve está relacionado ao beforeFilter, ou > a quantidade de redirecionamento que são feitos. > > Estou no aguardo da resposta dos Univesitários. Valeu!!! > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Problama com a função Session->setflash no I.E. Preciso de ajuda!!!
Salve, salve galera!!! Eu estou começando a aprender como utilizar o cake e estou com algumas dúvidas espero que vc´s possam me ajudar. Resumo: Estou com um probleminha. Quando eu utilizo a função $this- >Session->setFlash("Mensagem"); especificamente no Internet Explorer através da função beforeFilter() em um dos meus controles ela não é mostrada na tela logo de primeira, para eu isso aconteça eu tenho que dá um refresh, porém como eu disse isso só acontece com o IE. No opera e no Firefox a mesagem é exibida assim a página é carregada. O problema da íntegra: Criei um beforeFilter com a seguinte função no arquivo "modulos_controller.php": function beforeFilter() { $this->checkSession(); } Esta função possui o seguinte cógido: function checkSession() { if (!$this->Session->check("usuario")) { $this->Session->setFlash("Mensagem",null); $this->redirect("/"); exit; } } Ou seja, antes que o php interprete o conteúdo do arquivo "modulos_controller.php" ele checa a sessão para saber se o usuário já efetuou o login. Caso ele não o tenha feito ele será redirecionado para a página raiz e guardará a mensagem com a função setFlash. Na minha página raiz, index.php, a seguinte função é executada: if ($session->check('Message.flash')) { $session->flash(); } Nesta página o componente Session verifica se existe alguma mensagem com o ID = flash e caso seja verdade ele imprime esta mensagem na tela. Só relebrando eu estou começando a utilizar o cake tem pouco tempo, então pode ter alguma coisa que eu falei que não seja verdade, porém eu tô mostrando como eu entendi. Continuando... No Opera e no Firefox, simplesmente funciona, perfeitamente. Mas, no bendito Intenet Explorer eu preciso dá um refresh na tela após seu redirecionamento para que esta mensagem seja mostrada. Fiz um outro teste, coloque a mesma função setFlash e o redirecionamento direto no controller de autenticação do usuário "security/login" e fiz o redirecionamento, funcionou em todos os browser acho que o problema deve está relacionado ao beforeFilter, ou a quantidade de redirecionamento que são feitos. Estou no aguardo da resposta dos Univesitários. Valeu!!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: Session->setFlash(), Layouts and helpers
Congratulations, you found a bug in Cake. It's shocking, I know. But yes, it still does happen from time to time. Should be fixed in the next couple hours. If you think there might be a bug, you can report it at https://trac.cakephp.org, and it'll get fixed a little quicker. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Session->setFlash(), Layouts and helpers
All, After following the 'flashing' turtorial on the wiki ( http://wiki.cakephp.org/tutorials:flashing ) I was able to start using the flashing method described there. i.e using setFlash with a particular layout, which then appears as part of the page after a redirect(). ( The 'alternate CSS flash note' section). The problem I've found is that I can't use the HTML helper as part of the layout rendered with Session->setFlash(). It always barfs up the error: Fatal error: Call to a member function on a non-object in /app/views/layouts/inpageFlash.thtml on line 6 where line 6 is: echo $html->image('close.png', array('alt'=>'Close', 'border'=>'0', 'vspace'=>'2')); Now the flashing tutorial even talks about using images as part of the flash, but unfortunately doesn't give an example! Anyone able to point me in the right direction? If I comment that line out, the flashing works fine. A 'pr($this)' in the layout revealed that html is part of the helpers array of the view object, it just doesn't seem to be getting loaded? thanks Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---