Studyon Minte9.com
ZF 1.0

Study

Flashmessenger



#controller
public function messageAction() {
		
	$flm = $this->_helper->getHelper('FlashMessenger');
	
	$flm->addMessage(array('message'=>'Error message', 'status'=>'error'));
	$flm->addMessage(array('message'=>'Warning message', 'status'=>'warning'));
	$flm->addMessage(array('message'=>'Success message', 'status'=>'success'));

	$this->_redirect('/default/frontend/test');
}

public function testAction() {
	$flm = $this->_helper->getHelper('FlashMessenger');
	$this->view->messages = $flm->getMessages();
}

#view
<ul>
	<?php foreach($this->messages as $v): ?>
		<li class="<?php echo $v['status'] ?>"><?php echo $v['message'] ?>
	<?php endforeach; ?>
</ul>


http://framework.zend.com/manual/en/zend.controller.actionhelpers.html
http://blog.noumenal.co.uk/2009/08/using-zend-framework-flashmessenger.html
http://www.zfsnippets.com/snippets/view/id/37