We regularly write PHP, using the CakePHP framework, in Eclipse (Juno, with PHP Development Tools (PDT)). The view template files in CakePHP have the .ctp extension, which Eclipse does not, by default, recognise as PHP files, so you do not benefit from any of the helpful Eclipse PHP tools. However, you can add an association (i.e. tell Eclipse that .ctp files are PHP files), as follows:
- Go to Window > Preferences to open the Preferences box
- Go to General > Content Types in the menu
- In the Content types box, expand Text and select “PHP Content Type”
- Click “Add”
- Type “.ctp” in the box that appears and click OK
- Click OK to close the Preferences box
Note that you will have to close and then reopen any .ctp files that are already open in order for them to be recognised as PHP files.