php 向 Netbeans 添加自定义文件扩展名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/905416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Add a custom file extension to Netbeans
提问by garrow
I am trying to figure out how to add a custom file type to be recognised by Netbeans.
我想弄清楚如何添加自定义文件类型以供 Netbeans 识别。
I am editing .tpl files and I would like them to be recognised as PHP/HTML files.
我正在编辑 .tpl 文件,我希望它们被识别为 PHP/HTML 文件。
I've looked hereand herebut I cant find cnd.properties in config directory and there is no Advanced Optionsdialog in the options dialog.
我已经看过here和here,但在config目录中找不到cnd.properties,并且Advanced Options选项对话框中没有对话框。
I'm using Netbeans 6.5 with PHP and all modules up to date.
我将 Netbeans 6.5 与 PHP 和所有最新模块一起使用。
回答by karim79
Let me guess, for Smarty templates? I did the following
让我猜猜,对于 Smarty 模板?我做了以下
- Open Tools and Select Options.
- Select Miscellaneous tab.
- Select Files sub-tab thing.
- Click on Newfile extension and enter tpl.
- Select the mime type.
- Click OK. Done!
- (Restart of Netbeans may be required to see the actual changes)
- 打开工具并选择选项。
- 选择其他选项卡。
- 选择文件子选项卡的东西。
- 单击新文件扩展名并输入tpl。
- 选择 MIME 类型。
- 单击确定。完毕!
- (可能需要重新启动 Netbeans 才能看到实际更改)
回答by J?rg Bayreuther
In NetBeans 8.XX this is achieved by going to NetBeans > Preferences > Miscellaneous > Files. In the row File Extensionclick on NEWand enter your new file extension without the dot (example: tpl). Choose the Associated File Type (MIME)and click Apply.
在 NetBeans 8.XX 中,这是通过转到NetBeans > Preferences > Miscellaneous > Files 来实现的。在“文件扩展名”行中,单击“新建”并输入不带点的新文件扩展名(例如:tpl)。选择关联文件类型 (MIME)并单击应用。
回答by Shahadat Atom
Go to
去
Netbeans
tools
options
Miscellaneous
Files
Now find the row file extensionselect tpl. Then most importantto Choose the Associated File Type (MIME)as text/x-php5. After save this, restart netbeans.
现在找到行file extensionselect tpl。然后最重要的是选择Associated File Type (MIME)as text/x-php5。保存后,重新启动netbeans。
回答by codealfa
If you're looking for how to get Netbeans to recognize smarty templates, there's now a Smarty template plugin that should be more useful: http://plugins.netbeans.org/plugin/37379/php-smarty
如果您正在寻找如何让 Netbeans 识别 smarty 模板,现在有一个 Smarty 模板插件应该更有用:http: //plugins.netbeans.org/plugin/37379/php-smarty

