thanks for your suggestion.
But the problem I have in this solution is, that even when I call $this->accountAction() still the view script of the indexAction() is rendered.
While changing the actions like that works, the context doesn't.
bye,
Murphy
On Feb 20, 2009, at 3:47 AM, Diego Sainz Gomez wrote:
Murphy,
If you want your auth controller to decide what response to send via indexAction() and rendering the appropiate view, then let indexAction() run the appropiate action without requiring _forward(). te executed action should render its own view:
controller auth() { indexAction() { // If user has identity if (userhasIdentity) { // Account action renders its own view $this->accountAction(); return;} // User has not login in yet, render guest view $this->guestuserAction(); }accountAction() {// render account details view}}Regards, Diego
Murphy wrote:Hi,
I have a hard time trying to find a solution for this scenario:
I have a controller called "auth" for displaying a small "account information box" if a user is logged in,
or a "login-box" or "lost password", when no user is authenticated.
This is supposed to be my widget for all things related to authentication and user information.
I don't want to couple it with the rest of the application, because i want to be able to request
this widgets output e.g. "/auth/account" via AJAX later on.
But for the usual http request I just want to integrate it into the layout rendered by Zend_Layout.
I tried it with a Front Controller Plugin and called in "postDispatch":
$this->getResponse()->insert('auth', $view->action('index','auth'));
Problem is: The action helper allows no _forward() when I have something like this in my
auth/indexAction
if(Zend_Auth::getInstance()->hasIdentity()) $this->_forward('account');
But this is exactly what I want - a single entry point to a widget, then forward as the widget
sees fit, regarding user authentication information or session variables and so on.
A View_helper is no option, because I can't directly access it's output via an AJAX call,
and I really want to encapsulate all the auth-related funcionality in a controller
(like having an action extracting vCard information and so on).
I just now there has to be a solution for this but I couldn't find it
after hours of googling. Maybe someone here can point me in the direction.
Thanks,
Murphy
没有评论:
发表评论