I had the below function in phalcon3.4 which worked fine, however, after upgrading to the phalcon4 it seems to be giving me an error in VIEW\SIMPLE and i don't see any solution for that
/*
* Setting up the widget view component
*/
$di->set('widget', function () {
$view = new \Phalcon\Mvc\View\Simple();
$view->setViewsDir(__DIR__ . '/views/');
$view->registerEngines(
[
'.volt' => function (\Phalcon\Mvc\ViewBaseInterface $view) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $this);
$volt->setOptions(
[
'always' => true,
'extension' => '.html',
'separator' => '_',
'stat' => true,
'path' => __DIR__ . "/../../var/volt/",
'prefix' => 'views_widget_',
]
);
return $volt;
}
]
);
return $view;
});
I call this function like below
echo $this->widget->render(
"partials/_footer",
array(
"cur_year" => date("Y", time()),
)
);
The view file has
{# cache the sidebar by 1 hour #}
{% cache 'footer' 3600 %}
<div class="h-100 small">...
{% endcache %}
The error i get is
Phalcon\Mvc\View\Engine\Volt\Exception: Unknown statement 314 in
#0 [internal function]: Phalcon\Mvc\View\Engine\Volt\Compiler->statementList()
#1 [internal function]: Phalcon\Mvc\View\Engine\Volt\Compiler->compileSource()
#2 [internal function]: Phalcon\Mvc\View\Engine\Volt\Compiler->compileFile()
#3 [internal function]: Phalcon\Mvc\View\Engine\Volt\Compiler->compile()
#4 [internal function]: Phalcon\Mvc\View\Engine\Volt->render()
#5 [internal function]: Phalcon\Mvc\View\Simple->internalRender()