1

I'm using cakephp and whenever there comes a session based flash message, there comes "1" after every error/success message, why?

It is related with "echo" before this flashmessage, so any idea, which file to make correction for it? We're using cakephp 1.2 version - FYI

Earliest reply would be appreciated.

Thanks !

JohnP
  • 49,507
  • 13
  • 108
  • 140
Aditya P Bhatt
  • 21,431
  • 18
  • 85
  • 104

2 Answers2

2

Just remove the echo in front of your flash call $session->flash(); in default.ctp, that should do it

JohnP
  • 49,507
  • 13
  • 108
  • 140
  • its like flash(); ?> no echo there, and still it displays "1"... any idea? – Aditya P Bhatt Mar 14 '11 at 10:25
  • 1
    hmm, remove that bit and see if it still shows up. If it does, then you're editing the wrong file – JohnP Mar 14 '11 at 10:26
  • yes u're right, i remove that flash code and still the flash message appears with 1, i have also tried to edit into default cake's view template, still doesn't help. – Aditya P Bhatt Mar 14 '11 at 11:44
  • Don't edit anything inside the library. Make sure you're editing the correct template. Do you have it inside views/layout ? – JohnP Mar 14 '11 at 11:50
  • yes, i have put things back into library, as it was, yes i am editing into app/views/layout/default.ctp file.. but no difference yet.. – Aditya P Bhatt Mar 14 '11 at 12:00
  • Then it must be an issue when you put the message into the session. Check your `setFlash()` call. – JohnP Mar 14 '11 at 12:01
  • well, not sure about but just for your ref `$this->Session->setFlash('some flash message');` it is the way, we're using it into controllers – Aditya P Bhatt Mar 14 '11 at 12:07
  • hmm, weird. something in your view or layout is getting in the way. maybe a partial. You might want to do a project wide text search for `$session->flash(` to see where it's being called. – JohnP Mar 14 '11 at 12:08
0

Long shot but you haven't done some thing like this

$this->Session->setFlash(__( $this->FileHandler->errorMessage . true),'flash_error')

In the INCORRECT example above the __() internationalizations method should take two arguments. You haven't accidentally concatenated boolean true on the end?

Leo
  • 1,521
  • 12
  • 18