2011年1月28日星期五

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

I think you have not enabled your layout for your application.

Here is how you can enable your layout:
http://framework.zend.com/manual/en/learning.quickstart.create-layout.html

On Fri, Jan 28, 2011 at 9:21 AM, themarty <marty.korse@gmail.com> wrote:

>
> For a specific website i lack one functionality in Zend_View, so i want to
> extend it and use my extended version instead of Zend_View
>
> Most solutions that deal with this issue recommend to do it this way:
>
> Bootstrap.php
> <?php
> protected function _initView()
> {
> // Excudo_View extends Zend_View
> $view = new Excudo_View();
>
> // Add it to the ViewRenderer
> $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer' );
> $viewRenderer->setView($view);
>
> return $view;
> }
> ?>
>
> However, when i do it this way, i run into the following error:
>
> An exception occured: script 'layout.phtml' not found in path
> (./views\scripts/)
>
> When i var_dump the $view variable and compare it to a var_dump of this
> one:
> $view = Zend_Layout::getMvcInstance()->getView();
> i see that by that time in the bootstrap the view object already has set
> numerous properties, which is probably why i run into these errors.
>
> Instead of trying to set all those properties manually before i call
> setView() it would be nicer if i could somehow let the framework know it
> shouldn't use Zend_View, but Excudo_View instead. Is there a way to do
> this?
> (in application.ini for example).
> If there is not: what would be the cleanest way to ensure Excudo_View is
> loaded the same way Zend_View is loaded?
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/How-to-extend-Zend-View-tp3243933p3243933.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>

--
Met vriendelijke groet,

Jigal Sanders
A.J. Ernststraat 739
1082 LK Amsterdam
Mobiel: 06-42111489

没有评论: