if $this->Session->setFlash('this is message','flash_error');
only need create flash_error.ctp
in elements folder.
Then $this->Session->setFlash('this is message')
. How modify it. I dont want modify only css or javascript
if $this->Session->setFlash('this is message','flash_error');
only need create flash_error.ctp
in elements folder.
Then $this->Session->setFlash('this is message')
. How modify it. I dont want modify only css or javascript
According to CakePHP book entry on flash():
<?= $session->flash(); ?>
in a view file outputs:
<div id='flashMessage' class='message'>My Message</div>
So there is nothing to override but the CSS for this id in cake.generic.css.
Hope I understood the question correctly. =)
Have you tried to create a default.ctp in elements folder.
That might be what you wanted?
Regards
The-Di-Lab
www.startutorial.com
Laheab answer is right. But you can hack it using Controller beforeRender function. In your app/app_controller.php write this function :
function beforeRender(){
if ($this->Session->check('Message.flash')) {
$flash = $this->Session->read('Message.flash');
if ($flash['element'] == 'default') {
$flash['element'] = 'flash_error';
$this->Session->write($flash);
}
}
}
It will override the 'default' flash element with 'flash_error'. Then in app/views/elements create flash_error.ctp.