CakePHP 1.2 uses a new file extension for view files: .ctp (which stands for Cake Template). By default, there is no syntaxhighlighting in Eclipse for files with such an extension. So we have to manually associate .ctp with PHP. In Eclipse 3.2 we can do that in the following preferences page (it should be similar in Eclipse 3.1.x):


For those fortunate enough to be using TextMate:
1. Open .ctp file.
2. Select “HTML” or “PHP” from the Language menu at the bottom of the window
3. There is no step three. TextMate will remember your choice for future .ctp files.
(For Mac users using BBEdit, poke around the preferences — it’s pretty much the same as for Eclipse.)
@scott: Thanks for your explanation for TextMate.
Is there any information available as to *why* the view file extension is becoming .ctp?
Does anyone use PHP Eclipse. I tried onec and it’s fully buged. For me its much pleasure working in ZDE.
Yes, i use PHPEclipse, it’s a great php IDE. (mostly because eclipse is an awesome platform to extend and build upon)
@Ben: I think the reason for the change was that thtml implied HTML content.
@Dejan: Yes, I used PHPEclipse up to now, but today I switched to PHP IDE. Not due to bugs (it worked fine for me), but because the project seems rather dead.
@scott lewis: What “Language” Menu? I couldn’t find it for the life of me.
Similar stuff for Dreamweaver:
http://alexle.net/archives/119
@KesheR: Thanks for the link with explanations for Dreamweaver.
@Walker: At the bottom of the window in the ‘status bar’ there is a popup menu badged with a little grey circle with an ‘L’ in it. That’s the Language Menu.
Greetings,
For anyone who hits the following problem:
Whenever you open a file, it also opens in notepad/wordpad/your editor/asks you to download the file you want to edit/etc.
Under “PhpEclipse Web Development”
Disable both “Browser Preview defaults” options.
@AD7six: Thanks for this tip!
If You use cvs, you can add This content type to Team/File contetn, and you can change it from binary to ascii
@sajt: Thanks for this hint!
I’m looking for this for a long time.
Thank you for this tip !
[...] around for hints as to what the problem could be. A January 2007 comment on a post at cakebaker (Syntaxhighlighting for .ctp files in Eclipse) contained a suggestion: # AD7six 2007-01-12, [...]
Great! Thank you!
Thanks for the ctp help in eclipse.
@Steve: You are welcome!
thanks! very good tutorial
@marcao: You are welcome!
Hi .. Really i got benefited by this information.. Now i have added the .ctp files and working great.Thank you :)
@Aruna: You are welcome!
Thanks for very good information
Thanks :)
[...] Syntaxhighlighting for .ctp files in Eclipse Possibly related posts: (automatically generated)Amy Editor provides real-time collaborative Ruby [...]