I think line 99 in Zend/Application/Resource/Navigation.php is wrong. It
shouldn't explicitly get the view resource plugin but instead get the stored
view object from the application bootstrap. For now, you should restore the
resources.view[] line then modify and rename your _initView method:

protected function _initViewHelpers()
{
    $view = $this->bootstrap('view')->getResource('view');
    $view->docType('XHTML1_STRICT');
    $view->headTitle('My First Zend Framework Application');
}

   -- Mon


On Wed, May 20, 2009 at 9:04 PM, gerardroche <[email protected]> wrote:

>
> Hi,
>
> Having an issue though it may be expected behavior.
>
> Set up a ZF project via Quickstart zf Command Line Tool (which is great :))
>
> Add to application.ini
>
> resources.view[] =
> resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
> resources.navigation.pages.indexFoo.label = "Foo"
> resources.navigation.pages.indexFoo.controller = "index"
> resources.navigation.pages.indexFoo.action = "foo"
> resources.navigation.pages.indexBar.label = "Bar"
> resources.navigation.pages.indexBar.controller = "index"
> resources.navigation.pages.indexBar.action = "bar"
>
> In the view
>
> echo $this->navigation()->menu();
>
> Reference :
>
> http://hienoa.net/web/2009/05/03/getting-started-with-zend_navigation-with-two-simple-steps/
>
>
> Everything works great, the menu is echoed as expected.
>
>
> But if you now add a custom view resource in the bootstrap the menu
> disappears?
>
> e.g.
>
>    protected function _initView()
>    {
>        // Initialize view
>        $view = new Zend_View();
>        $view->doctype('XHTML1_STRICT');
>        $view->headTitle('My First Zend Framework Application');
>
>        // Add it to the ViewRenderer
>        $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper(
>            'ViewRenderer'
>        );
>        $viewRenderer->setView($view);
>
>        // Return it, so that it can be stored by the bootstrap
>        return $view;
>    }
>
>
> And if you then comment out view resource config  in application.ini
> i.e.
> ;resources.view[] =
>
> you get a fatal error:
>
> Fatal error: Call to a member function getView() on a non-object in
> path\to\1.8.1\library\Zend\Application\Resource\Navigation.php on line 100
>
>
>
> Is this expected behaviour? If so, i don't see why, I think you should be
> able to create a custom resource while still using other resources *even*
> when the they depend on the custom one, no?
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Zend_Navigation-and-Zend_Application-configs-tp23635058p23635058.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to