I'm programming an admin web ui for a online system, I managed to mount a url to the view using,
$app->get(
"/main/index",
function () use ($app){
//no echo here
$app["view"]->render(
"main","index"
);
}
);
And my Main controller is like,
<?php
class MainController extends ControllerBase
{
public function initialize()
{
$this->tag->setTitle('Home Page');
$this->view->setTemplateAfter('nav');
}
public function indexAction()
{
}
}
My view structure is like,
views
--layouts
----index.volt
----nav.volt
--main
----index.volt
--index.volt
My problem is no matter how I change the MainController code, it doesn't affect anything on the rendered view main,index
. So I wish to know what's wrong here?
The first parameter of render
is for your view template, the second is for your view parameters.
$app->get(
"/main/index",
function () use ($app) {
$app["view"]->render(
"main/index"
);
}
);
Just change "main","index"
to "main/index"
and your view should render.