•  0
    Ajax

    Use custom flash helper in Codeigniter

      Admin     3761        0        Report content

    Create new helper file and write the following function

    if ( ! function_exists('flash'))
    {
        function flash($type, $msg, $bold = '')
        {
            $ci=& get_instance();
            //type:success, info, warning, danger
            if($bold != ''){
                $bold = '<strong>'.$bold.'!</strong> ';
            }
            $flash = $ci->session->userdata('flash')?$ci->session->userdata('flash'):array();

            $flash[] = '
            <div class="alert alert-'.$type.' alert-dismissible" role="alert">
              <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              '.$bold.$msg.'
            </div>
            ';

            $ci->session->set_userdata('flash',$flash);
        }   
    }

     


  •  


Leave a Comment

Please Login to insert comment.

 

Facebook Conversations