[英]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.