2008年10月31日星期五

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

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());
}
}

--
View this message in context: http://www.nabble.com/Problems-with-stacked-view-script-paths--tp20268104p20268104.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: