new user: How to recognize php-code or html-code in a file with other file extensions

Hello

I'm just testing phpstorm for my needs.

I have a lot files ( templates) that contain html, php and javascript.
How can I force phpStorm to recognize these languages in a file, that has a complete different fileextension.
I found no hint in the documentation.

Piet

1 comment

Hi Peter,

In order for PhpStorm to recognize PHP code in some file, such file must be associated with "PHP files" file type. For this:

  1. Settings | File Types
  2. Locate "PHP files" entry in upper list
  3. Add desired pattern in the bottom list


PHP file in PhpStorm is treated as HTML file (HTML = HTML + JS + CSS) + inclusion of PHP code.

Please NOTE: "Settings | File Types" is IDE-wide setting and will affect ALL projects.


Same kind of story with HTML/JavaScript code:

  • If it's pure HTML (same code as in ordinary *.html file) or pure JavaScript (as in ordinary *.js file), then you need to associate with corresponding file types. HTML/JavaScript mix (using standard <script> tag) is considered as HTML file.
  • If it's something more complicated than this -- please provide some example of such file
0

Please sign in to leave a comment.