ZF-9245: Set the view class in options for Zend_Application_Resource_View

Issue Type: Improvement Created: 2010-02-23T12:08:04.000+0000 Last Updated: 2012-01-05T09:59:04.000+0000 Status: Open Fix version(s): Reporter: Brandon Parise (bparise) Assignee: Dolf Schimmel (Freeaqingme) (freak) Tags: - Zend_Application_Resource

Related issues: Attachments: - patch.patch


I have ran into a situation where I need to use a custom view. I quickly realized that the View resource explicitly calls Zend_View object which doesn't allow me an easy to way to set the "default view" of my app to my custom view.

There should be a simple option to pass in your custom class name for the view:

<pre class="highlight">
resources.view.className = "My_Custom_View_Class"

<pre class="highlight">
class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceAbstract
    // ... 

    public function getView()
        if (null === $this->_view) {
            $options = $this->getOptions();

            $className = 'Zend_View';
            if (isset($options['className'])) {
                $className = $options['className'];
            $this->_view = new $className($options);

            if(isset($options['doctype'])) {
        return $this->_view;


Posted by Brandon Parise (bparise) on 2010-02-23T12:09:34.000+0000

Patch for Zend/Application/Resource/View.php

Posted by André Roaldseth (tipex) on 2012-01-05T09:59:04.000+0000

Just ran into the same problem with ZF 1.11.11. Feels pretty bad to copypaste the entire Zend_Application_Resource_View::getView() method just for replacing Zend_View with my own view class.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.