How to use TODO within a .ctp file?

Hi, I am working with cakePHP and within my *.ctp files I would like to add TODO comments. It works while I am doing html stuff with <!-- TODO foo -->. But when I use <?php with my file and add // TODO bla foo within, this comment is not regognized as TODO. Any ideas how to solve this? I guess this is a setting releated thing?

7 comments

Hi Heidi,

Can you please provide some simple example of such file (with // TODO not being recognized).

0

Hi, sorry for the delay!
Do you see the attachment?
Do you see also that the behaviour that the php part is not throughout the <php> section syntax highlighted?
I think this also the reason, why the // TODO part is not regognized corretcly, as the ctp file does not really treat the ctp file like html including php - just my guess.

Any ideas how to solve this?



Attachment(s):
SNAG-0026.png
0

Hi Heidi,

From what I see the *.ctp files are associated with HTML files rather than with PHP. To solve this:
1) File | Settings | File Types
2) Remove association for *.ctp from "HTML files"
3) Add the same pattern (*.ctp) to "PHP files"

You may need to reopen those files to see the changes.

0

Hi,

I guess you have the same issue when you have a real .html file with php inside?
In these ctp files I do more html than php. The assignemnt to php would take away all html file advantages such as code completion ect, right?
Solving the one would cause another problem.

0

Wrong.
You should not "guess" and just try do as advised.

0

Hi Heidi,

I guess you have the same issue when you have a real .html file with php inside?

If it is assigned to "HTML files" in PhpStorm -- then Yes, it will be. Keep in mind that in order to have php code be executed inside .html file on the server (when requested directly, of course), the webserver have to route .html files trough php interpreter first (you have to explicitly configure this) instead of sending the html file directly into the browser. If you just include such .html files inside your .php file (using include/require) then it will be processed by php interpreter anyway.

In these ctp files I do more html than php. The assignemnt to php
would take away all html file advantages such as code completion ect,
right?

No. What is .php file? Generally speaking it is normal .html file with inclusion of php (inside <?php ?> tags or other supported delimiters). So, if you want to have PHP support inside your template (in addition to html/css/js) you have to assign it to PHP file type inside PhpStorm.

Solving the one would cause another problem.

No.

0

ok ok ok :-) You are right!

THANKS!!!!

0

Please sign in to leave a comment.