Adam
Adam

Reputation: 345

CakePHP Flash Messages Display Unwanted Number After

When I call $session->flash() in the view, the flash message does get displayed, however it also displays a number, usually 1, afterward it. See the html produced:

<div id="authMessage" class="flash flash_error">Passwords do not match</div>1

What is this, why does it now always happen, and how do I get rid of it?

Upvotes: 0

Views: 968

Answers (2)

Aditya P Bhatt
Aditya P Bhatt

Reputation: 22071

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

Upvotes: 0

deceze
deceze

Reputation: 522016

I guess you're doing this, right?

echo $session->flash();

You don't need to echo the flash(), it'll output by itself. What's happening is that flash() outputs the message and returns true, and you're echoing that true, which gets turned into '1'.

Upvotes: 5

Related Questions