We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt and phtml as view in same Phalcon project

I am currently using phalcon framework. I want to ask is it possible to use .volt and .phtml file extensions for my views in a same project. In my services.php file view component is set with this code:

$di->set('view', function() use ($config) {

$view = new View();

$view->setViewsDir($config->application->viewsDir);

$view->registerEngines(array(
    '.volt' => function($view, $di) use ($config) {

        $volt = new VoltEngine($view, $di);

        $volt->setOptions(array(
        'compiledPath' => $config->application->cacheDir .                      
                            'volt/',
            'compiledSeparator' => '_'
        ));

        return $volt;
    }
));

return $view;

}, true);

If is possible to write it so it opens .volt view files, as .phtml files, because I need to add some jQuery and Ajax in a view, and i it won't work in .volt.

What do you mean it won't work in Volt? Do you mean it won't render on the page, won't highlight/autocomplete in your IDE, or there are errors.



18.7k

now is ok, but I have problem when i use jquery-ui, it won't work. for example if i write $('#string').dialog(); it's not working

Hmm. Might not even be a Volt issue. Could you provide your code please?