Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans syntax highlighting for volt (twig) and php in phtml files

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?

like image 543
Ally Avatar asked May 24 '14 15:05

Ally


2 Answers

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.

like image 113
Apostle Avatar answered Nov 18 '22 21:11

Apostle


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.

like image 3
kbtz Avatar answered Nov 18 '22 22:11

kbtz