How to change the settings in order to treat .ctp templates files like .html file?

Hi, I am working with cakephp and their .ctp template files. I want to treat .ctp files like .html file, how can I do this? I added *.ctp already as file type, but it still dont has the same syntax highlight like html? What else can I do?

0
8 comments

Hi Heidi,

So, you have added *.ctp file pattern to "HTML files" in File | Settings | File Types. And that still does not work for you?

1) Try closing and re-opening that file in PhpStorm
2) Double check the pattern -- should be *.ctp, not just .ctp
3) Which icon ctp files have in project view ? (if assigned properly should be an icon with small h on green background)
4) How many of such ctp files you have tried to open so far ? If only one, then try open other files that have different names (sometime somehow file name get assigned as a pattern to Text File type (for example, index.php) and all files are opened and treated as PHP but all index.php are treated as plain text)

If still nothing -- Which Web/PhpStorm version and OS do you have? Can you post a screenshots (settings page, some ctp example file).

0

Hi, yes you are right! I looked again and found out that all other files are working fine except the index.ctp file!! Is there any solution for that case? Do you know other cakephp users? What do they use for their template files? Also html based or is there any other recommodation?

Thanks a lot!!
Heohni

0

Hi Heidi,

File | Settings | File Types --> Text Files

Check there for a pattern index.ctp (or something very similar) and remove it. If not in Text Files -- check all other file types.

EDIT.
I'm not using CakePHP myself, therefore -- do you use PHP inside ctp files? If so -- then better assign it to PHP Files instead of HTML.

0

Cool! Thanks! I found the index.ctp under the text files.
Now it works perfect!!

Except the little thing, that when I open a file, all nodes are closed and I have to open them all to get an overview.
Is there a way to set this automatically to be open?

0

You mean in Structure panel? There is "Expand all" button (at least in v2).

0

Check this settings page:
code-folding.jpg

0

Yep! Thank you so much!!
Wonderful support here :-)

0

@Andrey
@Dmitry

Thanks, gents, we really appreciate your help.

0

Please sign in to leave a comment.