Search code examples
phpeclipsevalidationfile-typesyntax-checking

Get PHP Eclipse to run error checking on different file-types


In my project I have a series of *.tpl files that I would like Eclipse to interpret as PHP code. I have managed to get syntax highlighting to work properly for these files by adding a *.tpl entry in Preferences -> General -> Editors -> Content Types. However this does not seem to also enable syntax error checking / validation.

So to be clear, I would like Eclipse to show me per-line errors in the editor and also indicate any errors/warnings on the files in the PHP Explorer - for files with a .tpl extension. Currently neither is happening.

I have tried also adding *.tpl to Preferences -> General -> Editors -> File Associations. I have tried pressing F5 in various relevant places, and have tried restarting Eclipse. The folder with the *.tpl files is a subdirectory of a source folder. Other subdirectories of this source folder are working correctly (although they have .php files). I don't know what else to do. Please help!

Thanks!


Solution

  • Well that's bizarre. I just tried to test Ashutosh's example and it worked. After creating a new file test.tpl, all of a sudden all other .tpl files in the project started being parsed/validated properly and all the warning/error icons suddenly appeared.

    So this seems like a bug in this version of Eclipse (http://www.zend.com/en/community/pdt/downloads). Hopefully this is a repeatable workaround for anyone else who experiences the problem though!

    Thanks very much guys.