Session->read( 'messages' ); $html = ''; // Add a div for each message using the type as the class foreach ($messages as $type => $msgs) { foreach ($msgs as $msg) { if (!empty($msg)) { $html .= "

$msg

"; } } } $html .= ""; // Clear the messages array from the session $this->Session->del( 'messages' ); return $this->output( $html ); } } ?>