I'm working with Phalcon in Netbeans. I see I can use twig plugin for template highlighting for volt files. I am using phtml files and want highlighting for volt (twig) and php. Is this possible?
Also related - Netbeans keeps duplicating my phtml view files and adding the extention .phtml.php to them. How can I fix that?
Go to Tools->Options->Miscellaneous->Files
right to "File Extensions" press "create" and type there "volt".
After that in "Associated File Type (MIME)" choose "TWIG (text/x-twig)".
Restart IDE.
I use twig syntax in PHPStorm and everything works fine. Look at Netbeans settings(or the twig plugin settings) and try to add new file extensions to be recognized as twig files like *.volt
and *.phtml
. If you can't figure out how to make volt files be recognized as twig files, as a last resort, you can change all you template files to .twig
then change Volt settings to recognize .twig
files as a Volt template, like:
//Registering Volt as template engine
$di->set('view', function() {
$view = new \Phalcon\Mvc\View();
$view->setViewsDir('../app/views/');
$view->registerEngines(array(
".twig" => 'Phalcon\Mvc\View\Engine\Volt'
));
return $view;
});
About .phtml.php
isn't Netbeans creating these files, it's Phalcon. All templates are compiled to .php
. They will be put in the same folder of your template unless you configure your Volt engine properly. More info about this here.
Go to Tools->Options->Miscellaneous->Files. Click New "File Extensions" and type there "volt". After that in "Associated File Type (MIME)" choose "TWIG (text/x-twig)". Restart IDE.