Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to customize Flash message in Cakephp 2.x?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 864
    Comment on it

    Hi Reader's,
    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

    Our_project/app/View/Elements/

    In this file, we have to put our own alert box flash Html in the following way:

    <p class="alert">
    
      <?php echo $message; ?>
    
    </p>

    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:

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: