public static function FlashMessage($msg) { $output = ''; $messages = explode(" ", $msg); foreach($messages as $message) { $flashmessage = Session::get_flash($message); if($flashmessage) { $output .= "<div class=\"alert-message $message\">"; if(is_array($flashmessage)) $output .= implode("<br />", $flashmessage); else $output .= $flashmessage; $output .= "</div>"; } } return $output; }
<?php echo Controller_Base::FlashMessage('success error info'); ?>
<!-- Begin messages --> <?php foreach (array('error', 'warning', 'success', 'info') as $type) { foreach(\Messages::instance()->get($type) as $message) { echo '<div class="',$message['type'],'-box">',$message['body'],'</div>',"\n"; } } \Messages::reset(); ?> <!-- End of messages -->
It looks like you're new here. If you want to get involved, click one of these buttons!