Syntax highlighting .html files as php in Eclipse

I keep forgetting how to do this so writing this down so I can refer to it later

I want .html to have the .php syntax highlighting as some we get .html to parse as .php. By default Eclipse doesn’t do this which is a right pain.

  1. Go to Window > Preferences
  2. In Preferences, go to General > Content Types
  3. Select PHP Source File and add *.html as a file association
  4. Click on File Associations link or General > Editors > File Associations
  5. Select *.html and add the PHP Editor as an associated editor - make it the default
  6. Next time you open a .html file with php tags, it’ll be highlighted as a php file! yay!

Have your say

Add your comment below, or trackback from your own site.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>