By Petr on Jun 11, 2008
Sometimes people ask me for an advice, how to set up NetBeans to treat some file with certain extension as PHP file. For example .phpt files are test files for testing PHP runtime, which contains PHP code and NetBeans Early Access treats these files only as a text files.
There are steps how to do it:
- Invoke Options dialog (Tools -> Options).
- In Options dialog press Advance Options button to display Advance Options dialog.
- Browse IDE Configuration -> System -> File Types.
- Expand the File Types node and select PHP Files node.
- In context menu select Open item, which opens the PHP MimeType resolver in editor.
- Close the Advance Options Dialog.
- Add the <ext> tag to the PHP File MimeType resolver. For the .phpt file is added <ext name="phpt"/> tag. The result file should contain:
<MIME-resolver> <file> <ext name="php"/> <ext name="php3"/> <ext name="php4"/> <ext name="php5"/> <ext name="inc"/> <ext name="phpt"/> <resolver mime="text/x-php5"/> </file> </MIME-resolver>
I know, this is not so simple as should be, but NetBeans core engineers are working on simplifying the UI. I hope it will be available in
NetBeans 6.5 and the specification you can see here.