How to recognize xx.json.php as php file?

Answered

Hi @all,

perhaps it is a beginners question but I can't figure it out:

I have some files named xx.json.php. phpStorm recognizes these files as json files, not as php files. How can I get these files be recognized as php files?

The file name structure is given bi framework, so I can't change the name to something other.

Much thanks for help.

Romana

0
6 comments

Hi there,

>I have some files named xx.json.php. phpStorm recognizes these files as json files, not as php files.

Not really -- it's still a php file but with JSON as outer language instead of default HTML.

 

Anyway: right now you can do fix this on per file basis (or per directory, if all files in it will be of the same type):

  • Settings/Preferences | Languages & Frameworks | Template Data Languages
  • Find you file(s)/folder in a tree and assign another language (e.g. Text files)
0
Avatar
Permanently deleted user

Hi Andriy,

thank You for the fast reply. I have found the described setting, but I can't edit something, there is no drop down list.

Perhaps I have described it a little wrong, because it is a file for a Joomla extension and this is a controller file used for Ajax requests, not a template file. Is there a possibility anyway?

Best

Romana

0

What do you mean you can edit it?

 

Please show what do you see there on your computer.

1

>Perhaps I have described it a little wrong, because it is a file for a Joomla extension and this is a controller file used for Ajax requests, not a template file. Is there a possibility anyway?

What ordinary `.php` (e.g. "test.php") is? In simple words: it's a HTML file with PHP code inside <?php ?> tags.

Same for test.json.php ... just IDE automatically assigns JSON instead of HTML.

So with that in mind -- the aforementioned settings allow you to remove such "automatic json-type assignment"

 

BTW: can yo show what file content is (share the file somewhere) and what problems do you have with it?

1
Avatar
Permanently deleted user

Oh. lucky me! With Your image I found the drop down list an selected HTML and tata: All okay!

Many thanks!

Romana

P.S. How can I mark this thread as solved?

0

I'll do that for you :)

0

Please sign in to leave a comment.