我有一个包含约60个表格报告页面的站点。想要将其转换为Zend。报告有两种状态:空报告和填充了数据的报告。每个报告都有自己的一组输入框和选择下拉框以缩小搜索范围。您点击提交按钮,它就会检索数据。每个页面的功能仅限于此。
我是否需要创建60个控制器,每个控制器都有默认的index操作和getData操作?我在网上阅读的所有内容都没有真正描述如何设计一个真实的站点。
我有一个包含约60个表格报告页面的站点。想要将其转换为Zend。报告有两种状态:空报告和填充了数据的报告。每个报告都有自己的一组输入框和选择下拉框以缩小搜索范围。您点击提交按钮,它就会检索数据。每个页面的功能仅限于此。
我是否需要创建60个控制器,每个控制器都有默认的index操作和getData操作?我在网上阅读的所有内容都没有真正描述如何设计一个真实的站点。
$router = $ctrl->getRouter(); // returns a rewrite router by default
$router->addRoute(
'reports',
new Zend_Controller_Router_Route('reports/:report_name/:action',
array('controller' => 'reports',
'action' => 'view'))
);
然后在你的控制器中添加类似于以下代码...
public function viewAction() {
$report = $this->getRequest()->getParam("report_name");
// ... check to see if report name is valid
// ... stuff to set up for viewing report...
}
public function runAction() {
$report = $this->getRequest()->getParam("report_name");
// ... check to see if report name is valid
// Go ahead and pass the array of request params, as your report might need them
$reportRunner = new CustomReportRunner( $report, $this->getRequest()->getParams() );
$reportRunner->run();
}