/** * Koch FrameworkSmarty Viewhelper for rendering Flashmessages */ function smarty_function_flashmessages($params, $smarty) { // render only a certain type of flashmessages if ($params['type'] !== null) { return Koch_Flashmessages::render($params['type']); } else { // render all return Koch_Flashmessages::render(); } }
/** * Detects a flashmessage tunneling via the redirect messagetext * * @param string $message Redirect Message ("flashmessagetype#message text") */ public static function detectTypeAndSetFlashmessage($message) { // detect if a flashmessage is tunneled if ($message !== null and true === (bool) strpos($message, '#')) { // split at tunneling separator $array = explode('#', $message); // results in: array[0] = type and array[1] = message) Koch_Flashmessages::setMessage($array[0], $array[1]); // return the message return $array[1]; } }