Normally, the $this->Session->setFlash(__('My message.'));
Will output:
<div id="flashMessage" class="message">
My message.
</div>
How can I change that, so it'll output:
<p class="notification>
My message.
</p>
instead?
If you look at the source code you will see that the second parameter of the SessionComponent method is the name of an element:
function setFlash($message, $element = 'default', $params = array(), $key = 'flash')
You can create a file in views/elements (or Views/Elements for Cake2) called for instance 'flash_notification.ctp'
with the following content:
<p class="notification">
<?php echo $message; ?>
</p>
and use
$this->Session->setFlash(__('My message.'), 'flash_notification');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With