Problems with the Volt and controller

What function you want to call? Can you add some code?

What function you want to call? Can you add some code?

forgot)) ddiff()

In your service file where you define Volt:

// View
$di->setShared('view', function() use ($di) {
    $view = new \Phalcon\Mvc\View();
        '.phtml' => function($view, $di) {
            $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);


            // Extended functions
            $compiler->addFunction('ddiff', function($resolvedArgs, $exprArgs){
                return 'Vokuro\Controllers\IndexController::ddiff(' . $resolvedArgs . ')';
            return $volt;
    return $view;

In your controller, make the ddiff function static:

public static function ddiff()

In your Volt file:

{{ ddiff() }}

But you should move the ddiff function in external file, be it library or helper. It does not belong in the controller.

edited Apr '18

Sorry I can't understand what should be instead of points.

And error with var $compiler:

Notice: Undefined variable: compiler in /home/amanskiy/web/ on line 207

Fatal error: Uncaught Error: Call to a member function addFunction() on null in /home/amanskiy/web/ Stack trace: #0 [internal function]: Closure->{closure}(Object(Phalcon\Mvc\View), Object(Phalcon\Di\FactoryDefault)) #1 [internal function]: Phalcon\Mvc\View->_loadTemplateEngines() #2 [internal function]: Phalcon\Mvc\View->render('index', 'index') #3 /home/amanskiy/web/ Phalcon\Mvc\Application->handle() #4 {main} thrown in /home/amanskiy/web/ on line 207

... means there is other code that is not important to the problem. Can you paste your Volt service definition so i can show you where to put it?