Thanks! That worked to get my layout working again. I cracked the book "Pro
Zend Framework Techniques" again, and he has it set up like that, too. So it
makes a bit more sense to me.
However, my original issue is still not working. I still don't see my
messages in the JSON response. :-\ Right back where I started.
Here's my plugin:
class Plugin_FlashMessenger extends Zend_Controller_Plugin_Abstract
{
public function postDispatch($request)
{
$front = Zend_Controller_Front::getInstance();
$bootstrap = $front->getParam('bootstrap');
$view = $bootstrap->getResource('view');
$flashMessenger =
Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
$messages = $flashMessenger->getMessages ();
if ( $flashMessenger->hasCurrentMessages () )
{
$messages = array_merge ( $messages,
$flashMessenger->getCurrentMessages
() );
$flashMessenger->clearCurrentMessages ();
}
$view->messages = $messages;
}
}
If there are any flash messages, they appear in my rendered page. Any data
passed to the view ($this->view->foo = "bar") appears in my rendered page.
But calling the page via the JSON context only shows the data passed to the
view in the controller. Any data passed to the view from my plugin doesn't
get sent in the json body! I know the plugin gets called during an AJAX
request. I have confirmed that. Any ideas?
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/How-can-I-inlude-flashMessenger-messages-in-JSON-context-tp3301296p3303049.html
Sent from the Zend Framework mailing list archive at Nabble.com.