[英]Phalcon view controller is not controlling the view
我正在为在线系统编程一个管理Web ui,我设法使用以下方法将网址安装到视图中:
$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"
,您的视图就应该呈现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.