2010年2月21日星期日

[fw-mvc] How to extend Zend_View?

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!

--
View this message in context: http://n4.nabble.com/How-to-extend-Zend-View-tp1563653p1563653.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: