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

风格不统一 提交于 2019-12-03 16:07:02

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!