Created
March 31, 2011 08:22
-
-
Save aur1mas/896024 to your computer and use it in GitHub Desktop.
FlashMessenger implementation with title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Core_Controller_Action extends Zend_Controller_Action | |
{ | |
/** | |
* add flash message | |
* | |
* @param string $message message to output | |
* @param string $title message title | |
* @return void | |
* @author aur1mas <aur1mas@devnet.lt> | |
*/ | |
protected function _addMessage($message, $title = null) | |
{ | |
$flashMessenger = $this->getHelper('FlashMessenger'); | |
$flashMessenger->setNamespace('default'); | |
$flashMessenger->addMessage($message); | |
if (!is_null($title)) { | |
$flashMessenger->setNamespace('title'); | |
$flashMessenger->addMessage($title); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?$flashMessenger = Zend_Controller_Action_HelperBroker::hasHelper('FlashMessenger') ? Zend_Controller_Action_HelperBroker::getExistingHelper('FlashMessenger') : new Zend_Controller_Action_Helper_FlashMessenger()?> | |
<?if ($flashMessenger->hasMessages()):?> | |
<? $flashMessenger->setNamespace('default'); | |
$message = implode("<br />", $flashMessenger->getMessages()); | |
$flashMessenger->setNamespace('title'); | |
$title = implode(" ", $flashMessenger->getMessages()); | |
?> | |
<script type="text/javascript"> | |
$(document).ready(function() | |
{ | |
$('#flash-messenger').dialog({ minHeight: 100, minWidth: 450 }); | |
}); | |
</script> | |
<div id="flash-messenger" style="display: none;" title="<?=$title?>"><?=$message?></div> | |
<?endif?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment