[Phpwm] Zend Framework - FlashMessenger
Elliot Smith
elliot at townx.org
Mon Jul 16 10:39:28 BST 2007
Hello all,
I've recently started toying with the Zend Framework to get a bit of a
feel for it. Everything is going OK, apart from I can't for the life of
me get the FlashMessenger to work. (This might not make much sense to
non-Zend Framework people, but hopefully should make sense to the ZF
experts out there.)
I've got the framework up and running fine, and have my front controller
set up like this (as index.php):
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
'./zendframework/library');
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Controller/Action.php';
require_once 'Zend/Session/Namespace.php';
Zend_Session::start();
$front = Zend_Controller_Front::getInstance();
$front->addControllerDirectory('./app/controllers');
$front->throwExceptions(true);
$front->dispatch();
?>
So all the appropriate classes are available etc.. I've also got the
actions set up properly, so they render their templates without any
problems. The problems start when I try to use FlashMessenger like this
from an action:
<?php
class IndexController extends Zend_Controller_Action {
public function indexAction() {
$this->_helper->FlashMessenger->addMessage('hello world');
}
}
?>
This renders the template fine, and initialises the session so I get a
nice FlashMessenger bit in the session file on the server, e.g.
__ZF|a:1:{s:14:"FlashMessenger";a:1:{s:4:"ENNH";i:1;}}FlashMessenger|a:1:{s:7:"default";a:0:{}}
Which looks about right.
However, I can't see my message anywhere in this session file; or in the
FlashMessenger instance or $_SESSION if I var_dump() them. I've tried
adding another action which tries to render the message, but no luck
there either. I am at a bit of a loss, as I think I've followed the
documentation correctly. If anyone could shed any light on this, or
explain any gotchas, or give me a fragment of code which will work, I'd
be very grateful. I've tried everything I can think of and have probably
spent a good couple of hours on this, getting very frustrated.
By the way, I'm using Zend Framework 1.0.0 with PHP 5.2.0.
Thanks.
Elliot
More information about the Phpwm
mailing list