I have a single page app (smaller in functionality than even a micro app). This app is using a view file defined elsewhere to generate some output. How do I go about setting up a standalone SimpleView
component to generate the HTML from my view?
This is what I have now:
$DI = new \Phalcon\DI\FactoryDefault();
$View = new \Phalcon\Mvc\View\Simple;
$View->registerEngines([
'.phtml'=>function($simpleView,$DI){
$Volt = new \Phalcon\Mvc\View\Engine\Volt($simpleView,$DI);
$Volt->setOptions([
'compiledPath'=>'/tmp',
'compileAlways'=>TRUE
]);
return $Volt;
}
]);
$View->setViewsDir($aia_path.'/app/view/');
echo $View->render('query/index',['Response'=>$Response]);
Which is giving me a Fatal Error:
Uncaught Phalcon\Mvc\View\Exception: A dependency injector container is required to obtain the application services in phalcon/mvc/view/simple.zep:159
But I thought I was passing the DI everywhere it needed to be...