In a CakePHP 1.2
app, I'm using
<?php $session->flash();?>
to output messages like "Record edited". It's working great.
However, I want to add a link called "Dismiss" that will fade out the message. I know how to construct the link, but I don't know how to insert into the output of the flass message.
The flash message wraps itself in a DIV tag
. I want to insert my dismiss code into that div, but I don't know how.
Figured this out: Create a new layout in your layouts folder:
layouts/message.ctp
In that layout, include the call to output the content:
<?php echo $content_for_layout; ?>
Then when you set the flash message, specify the layout to use:
$this->Session->setFlash('Your record has been created! Wicked!','message');