【发布时间】:2010-07-22 13:29:04
【问题描述】:
我只是在阅读 zend 框架文档上的 zend view action helpers。所以我创建了一个索引操作
// index.phtml
...
echo $this->action(
$action = "widgetenabledoutput",
$controller = "index",
$module = null,
array(
"noLayout" => true,
"itemsPerPage" => 15
)
);
// index controller (IndexController.php)
public function widgetenabledoutputAction() {
$noLayout = $this->getRequest()->getParam("noLayout");
$itemsPerPage = $this->getRequest()->getParam("itemsPerPage");
if ($noLayout) { // i made this such that this page/action can be displayed with layout and without.
$this->_helper->layout->disableLayout();
}
$html = "<ul>";
for ($i = 1; $i <= $itemsPerPage; $i++) {
echo "<li>Item $i</li>";
}
$html .= "</ul>";
$this->view->html = $html;
}
我得到的错误是在索引操作 index.phtml 中,我的目的是获取 widgetenabledoutputAction 的输出(列表)而不是 widgetenabledoutputAction 的布局,但我想要 indexAction 的布局有道理?难道我做错了什么?还是我必须为我想使用动作助手的东西做一个微妙的动作?
【问题讨论】:
标签: zend-framework