Add a custom file extension to Netbeans

PhpNetbeansIde

Php Problem Overview


I am trying to figure out how to add a custom file type to be recognised by Netbeans.

I am editing .tpl files and I would like them to be recognised as PHP/HTML files.

I've looked here and here but I cant find cnd.properties in config directory and there is no Advanced Options dialog in the options dialog.

I'm using Netbeans 6.5 with PHP and all modules up to date.

Php Solutions


Solution 1 - Php

Let me guess, for Smarty templates? I did the following

  1. Open Tools and Select Options.
  2. Select Miscellaneous tab.
  3. Select Files sub-tab thing.
  4. Click on New file extension and enter tpl.
  5. Select the mime type.
  6. Click OK. Done!
  7. (Restart of Netbeans may be required to see the actual changes)

Solution 2 - Php

In NetBeans 8.XX this is achieved by going to NetBeans > Preferences > Miscellaneous > Files. In the row File Extension click on NEW and enter your new file extension without the dot (example: tpl). Choose the Associated File Type (MIME) and click Apply.

Solution 3 - Php

Go to

Netbeans
    tools
     options
      Miscellaneous
        Files

Now find the row file extension select tpl . Then most important to Choose the Associated File Type (MIME) as text/x-php5. After save this, restart netbeans.

Solution 4 - Php

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiongarrowView Question on Stackoverflow
Solution 1 - Phpkarim79View Answer on Stackoverflow
Solution 2 - PhpJörg BayreutherView Answer on Stackoverflow
Solution 3 - PhpShahadat AtomView Answer on Stackoverflow
Solution 4 - PhpcodealfaView Answer on Stackoverflow