Welcome to FindNerd,today we are going to discuss how to customize flash message in Cakephp 2.x?
If we want to customize flash message with alert flash box in our CakePHP web application.So for that we have to follow below process.
Step 1 : First we have to include the session component like below:
public $components = array('Session');
Step 2: Now we will create alert_flash.ctp file in Elements folder located in
In this file, we have to put our own alert box flash Html in the following way:
<?php echo $message; ?>
Now save this alert_flash.ctp file.
Step 3: Now we will call the method SetFlash in our controller.
Code will be like below
$this->Session->setFlash(__('Your message.'), 'alert_flash');
Now we have to save our controller and perform action to get this flash message: