Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Volt inside simple view error

     $simple_view = new \Phalcon\Mvc\View\Simple();
              ".phtml" => "Phalcon\\Mvc\\View\\Engine\\Php",
              ".volt"  => "Phalcon\\Mvc\\View\\Engine\\Volt"
      $simple_view->setViewsDir( __DIR__ . '/../../Templates/Phalcon/');
      echo  $simple_view->render('Models');

hello every body

when i registering engines into simple view, i have this error:

A dependency injector container is required to obtain the application services

How to use volt engine inside simple view?


you need to register it as a service, just use Shared false, like you register your router etc...

$di->set("simpleView", function(){

    view = new view..

    register ...

    return $view;

}, false );


//in controller 

$this->getDI()->get("simpleView")->render ...