开发者

using action helpers in Zend Framework 1.8

Hi am starting off with Zend Framework and have a question about action helpers. My first application is a simple authentication system (following a tutorial from a book). The registration and authentication seems to work fine but the redirect doesn't.

I have a customer controller that has this among others:

class CustomerController extends Zend_Controller_Action 
{

// some code here......

public function authenticateAction()
{
    $request = $this->getRequest();
    if (!$request->isPost()) {
        return $this->_helper->redirector('login');
    }

    // Validate
    $form = $this->_forms['login'];
    if (!$form->isValid($request->getPost())) {
        return $this->render('login');
    }

    if (false === $this->_authService->authenticate($form->getValues())) {
        $form->setDescription('Login failed, please try again.');
        return $this->render('login');
    }

    return $this->_helper->redirector('index');
}

the authenticate url is http://localhost/customer/authenticate and this开发者_开发问答 seems to work fine but it does not redirect. After authentication I get a blank page which looks like its taking me to the index and just sits there. I tried using '/index' instead but that did not help either. Do I need to do anything special to make the redirector helper work? I have a logout action which behaves the same.


You should call

 $this->_helper->redirector('index');

without the return.


I found out there may be a problem with my setup. The code above is perfect, works on another computer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜