hi, i use your file (https://github.com/fuel/depot/blob/1.0/develop/fuel/app/classes/messages.php) and problem solved. please help me if my code is wrong or is better way to show message : for show message i use : if (Messages::any()) { $message = Messages::get(); $message = Arr::unique($message); foreach ($message as $msg) { $type = $msg['type']; if ($msg['type'] == 'error') { $type = 'danger'; } echo '<div class="alert alert-' . $type . ' alert-dismissible" role="alert">' . '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' . '<span aria-hidden="true">×</span>' . '</button>' . '<p> ' . $msg['body'] . '</p></div>'; } Messages::reset(); }
Can't say whether or not that is ok, it greatly depends on your application, and the architecture of the application.
Our webengine is widget driven, and the messages widget uses a presenter that does the retrieval, the pre-processing, and the reset. And the HTML is a view in a theme, so that can be anything.
All I can say is that I strongly suggest to stick to MVC architecture and Fuel's design philosophy, and not mix html and code like you do now. That prepping code should be in a Presenter (or in a controller method if you have to, and only the HTML and the foreach loop should be in the view. Mixing them will become a maintenance nightmare in the future.