2008年10月31日星期五

Re: [fw-mvc] Problems with stacked view script paths?

Maybe the Layout plugin is running after your own? Check the plugin
broker and make sure yours runs after Layout.

Kind Regards,

*Daniel Skinner*

browman wrote:
> I'm having some fun trying to implement a theming mechanism for a site and am
> wondering if anyone can help out.
>
> I've managed to sort out the layouts correctly, but there are a few
> instances where I need to override the default view scripts to present
> content differently for some actions.
>
> Here's the code for the theme plugin which seems to be doing it's stuff
> properly, but for some reason it's just refusing to use the viewscript in
> the theme path? I've tried a static call to the viewrenderer, as well as
> the method shown below both with the same result, it uses the default
> view... anyone got any ideas.
>
> class UP_Plugin_Theme extends Zend_Controller_Plugin_Abstract {
> /**
> * @var UP_Theme
> */
> private $theme;
>
> public function preDispatch($request) {
> $site = Zend_Registry::get('UP_Row_Site');
> $this->theme = UP_Theme::getInstance();
> $this->theme->setTheme($site->theme);
> }
>
> public function postDispatch($request) {
> $layout = Zend_Layout::getMvcInstance();
> $layout->setLayoutPath($this->theme->getLayoutPath());
> $view = $layout->getView();
> $view->addScriptPath($this->theme->getScriptPath());
> }
> }
>
>

没有评论: