5

I am using the Zend Framework.

I have a controller named 'UserController' that has a public function displayAction().

I would like to know how I can get that action method to use a different viewer than the default display.phtml.

Any help is appreciated.

2 Answers 2

17

You can use

$this->render('actionName');

or, alternatively, you can call a view script directly by calling

$this->renderScript('path/to/viewscript.phtml');

For more information, you can take a look at http://framework.zend.com/manual/en/zend.controller.actionhelpers.html, specifically the parts about the render() and renderScript() methods.

Sign up to request clarification or add additional context in comments.

Comments

1

Lately, I've been getting errors with the method described above (using ZF 1.11.11). I've had success with this:

$this->_helper->viewRenderer('action');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.