0
发送数据我想给从动作助手的一些数据,以局部而我无法做到这一点,以获得清晰的图像。这里是我使用的所有相关代码。从动作助手到局部视图
在我layout.phtml
我使用这个占位符。生成onDemand导航菜单。
<?php echo $this->placeholder('action-navigation'); ?>
因此,当我需要它在我的控制器或操作方法,我可以简单地使用此代码。
$this->_helper->navigation()->renderActionNavigation();
我正在使用的操作助手是。
class Zend_Controller_Action_Helper_Navigation extends Zend_Controller_Action_Helper_Abstract
{
private $_view = null;
public function direct()
{
$this->_view = $view = Zend_Layout::getMvcInstance()->getView();
$this->_view->placeholder('action-navigation');
return $this;
}
public function renderActionNavigation()
{
$config = new Zend_Config_Xml(
APPLICATION_PATH.'/configs/navigation.xml', strtolower(
$this->getRequest()->getControllerName().
$this->getRequest()->getActionName()
)
);
$container = new Zend_Navigation($config);
// here i want to send $container to _action-navigation.phtml.
$this->_view->addScriptPath(APPLICATION_PATH.'/layouts/')->render('partials/_action-navigation.phtml');
}
}
这是我的看法偏_action-navigation.phtml
$this->placeholder('action-navigation')->captureStart();
//i want to get zend_navigation instance. from the above action helper here.
$this->placeholder('action-navigation')->captureEnd();
我有问题发送从动作助手数据,以局部视图_action-navigation.phtml
我该怎么做呢?
谢谢。
它的工作原理。非常感谢你@Liyali :) – 2012-04-12 13:22:18