Hello,
I am learning Volt using this toturial, so I just created a very basic view in app/views/posts/index.phtml like so:
<!DOCTYPE html>
<html>
<head>
<title>{{ title }} - An example blog</title>
</head>
<body>
<h1>{{ title }}</h1>
</body>
</html>
And the corresponding controller in app/controllers/PostsController.php
<?php
use Phalcon\Mvc\Controller;
class PostsController extends Controller
{
public function indexAction()
{
$this->view->title = "Hello";
}
}
But when I access to locahost/myapp/posts, I get this output:
{{ title }}
But I expected "Hello" to be displayed instead. I suspected that Volt was not initiated in the bootstrap file so I added this code to the view component setup:
$view->registerEngines(
[
'.volt' => 'voltService',
]
);
But now I get the following error:
Exception: Service 'voltService' wasn't found in the dependency injection container
Do you have any idea hwo to solve this issue ?
Thanks a lot