2010年2月21日星期日

Re: [fw-mvc] How to extend Zend_View?

You should take a look to the documentation:

http://framework.zend.com/manual/en/zend.view.abstract.html

--
Regards,

Pieter Kokx
PHP Developer
Zend Framework developer

electrotype schreef:
> I try to extend Zend_View. I know I could create helpers but I would prefere
> to really extend Zend_View in my application.
>
> I tried what's suggested
> http://sandhillcreative.com/kb/2009/04/29/extending-zend-view-to-implement-a-concrete-function/
> here , but without success.
>
> My class:
> ---------------------------------
> My_View extends Zend_View
> {
> //...
> }
> --------------------------------
>
> In my application bootstrap _init function:
>
> --------------------------------
> $view = new My_View();
> $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
> $viewRenderer->setView($view);
> Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
> --------------------------------
>
> But when the code reaches a view script, let's say index.phtml, "$this" is
> an instance of Zend_View, not of My_View!
>
> I'm very new to the Zend Framework. I started my test application from the "
> http://framework.zend.com/manual/en/learning.quickstart.intro.html quick
> start " demo.
>
>
> Can someone help?
>
> Thanks in advance!
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

没有评论: