我正在为在线系统编程一个管理web ui,我设法使用
将url挂载到视图,$app->get(
"/main/index",
function () use ($app){
//no echo here
$app["view"]->render(
"main","index"
);
}
);
我的主控制器就像,
<?php
class MainController extends ControllerBase
{
public function initialize()
{
$this->tag->setTitle('Home Page');
$this->view->setTemplateAfter('nav');
}
public function indexAction()
{
}
}
我的视图结构是,
views
--layouts
----index.volt
----nav.volt
--main
----index.volt
--index.volt
我的问题是无论我如何改变MainController代码,它不会影响渲染视图main,index
上的任何东西。所以我想知道这里出了什么问题?
render
的第一个参数是你的视图模板,第二个是你的视图参数。
$app->get(
"/main/index",
function () use ($app) {
$app["view"]->render(
"main/index"
);
}
);
只需将"main","index"
更改为"main/index"
,您的视图应该渲染