0

A noob question

$this->_helper->viewRenderer->setNoRender();

The above line is taken from indexController's init method in a tutorial that I have been following. Does the code sample really mean execute "setNoRender" method from viewRenderer object from _helper object from zend_Controller_Action object? Or is there a code writing convention specific to zend framework that I am unaware of?

1 Answer 1

1

Its not a zend convention. Its a PHP syntax.

$this refers to current obj. Using -> operator you can access its properties or methods.

Does the code sample really mean execute "setNoRender" method from viewRenderer object from _helper object from zend_Controller_Action object?

Yes you are correct.

$this->_helper->viewRenderer->setNoRender();

This will disable the view, it is very useful when you using an ajax request.

FYI: Zend Controller action

The primary reasons to disable the ViewRenderer are if you simply do not need a view object or if you are not rendering via view scripts (for instance, when using an action controller to serve web service protocols such as SOAP, XML-RPC, or REST). In most cases, you will never need to globally disable the ViewRenderer, only selectively within individual controllers or actions.

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

1 Comment

Thanks Venu for the detailed answer!

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.