Add a custom file extension to Netbeans

26,693

Solution 1

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

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

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.

Share:
26,693
garrow
Author by

garrow

Updated on July 09, 2022

Comments

  • garrow
    garrow almost 2 years

    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.

  • Stephan Celis
    Stephan Celis almost 11 years
    I don't have a files tab on my netbeans 6.0.1 (upgrading isn't an option for this project). Is there an alternative? (don't know if it's relevant but I use it on ubuntu8)
  • frnhr
    frnhr almost 11 years
    Still relevant but: I'd like to use extension with a dot (like "somefile.css.php") and it won't let me save if there is a dot in the extensions :(
  • towi
    towi almost 11 years
    Is this possible per project, too? Maybe even in a way that it is attached to the file or project? In the sense: when I commit this configuration change to the source repository other team members will benefit from it?
  • duckduckgo
    duckduckgo about 10 years
    there is better match "text/x-php5" compared to tpl which is a generic template for html
  • Rolf
    Rolf almost 8 years
    This dates back to 2011 and is made for Netbeans 7.0.
  • Rolf
    Rolf almost 8 years
    Nope, doesn't work. The editor treats tpl files still as "all files", not as "html files" (I set 2 space indentation for html and 4 space indentation for all files, and Source/Format reformats my TPLs still with 4 spaces, not two. Any suggestions what I might do wrong?
  • codingmechanic
    codingmechanic over 2 years
    Did it for me with .md files from revealjs. Very helpful!