Eclipse has become a powerful IDE for PHP development. As with most open source projects, eclipse provides multiple options how to use it with php and also how to work with smarty.
The available options to work with smarty depends on the way you use eclipse for php.
There are three main options for PHP development with Eclipse:
- PHPEclipse as a set of plugins and features for Eclipse
- ZEND Studio which is based Eclipse
- Eclipse PHP development tools
The first two options already provide a Smarty support. So it is easy to work with the smarty template engine out-of-the-box.
In the past, the third option has not been as powerful as the first two. But this has changed with Ganimed (Eclipse 3.4) and also with Galileo (Eclipse 3.5). The PHP development tools are now available in the 2nd major release. Unfortunately those PHP development tools do not include any support for Smarty.
There is a plugin named SmartyPDT which provides all required features for smarty programming. The project did no progress since a couple of month, however, it is publicly available on Google Code: http://code.google.com/p/smartypdt
Unfortunatly, the latest release download is not installable in Eclipse Kepler because of a missing dependency. If you try to, you will end up with an install error message such as:
Cannot complete the install because one or more required items could not be found. Software being installed: Smarty Feature 0.91.0 (org.eclipse.php.smarty_feature.feature.group 0.91.0) Missing requirement: Smarty Feature 0.91.0 (org.eclipse.php.smarty_feature.feature.group 0.91.0) requires 'org.eclipse.php 0.0.0' but it could not be found
If you are interested in installing it anyway, you need to modify the content.xml, included in the content.jar included in the downlaod zip archive.
You must remove the dependencies for the org.eclipse.php plugins on the lines 36 and 134.
To simplify the installation, I have prepared a valid update site archive to download: smartypdt-0_9_1
Just download and open Eclipse. Go to help -> install new software -> click “add” button and the “archive” button in the new dialog to select the downloaded archive file.
Confirm the dialogs and you will be able to install the SmartyPDT feature to your Eclipse instance.
Note: This is just a download provided as is and as a convenience method to enable SmartyPDT installation in Eclipse Kepler. The complete development was done by https://code.google.com/p/smartypdt who are the owner of and responsible for the plugin.
SSE-bases Smarty Editor
An alternative is hard to find but there is one also available for the latest releases of Eclipse. It is a small editor written by a Japanese developer that provides code completion and highlighting. This editor ensures at least the basic support that is a must have. The webpage is in japanese without any english translation. But the only thing you have to do is to download the jar file for the plugin and place it in your Eclipse plugin directory. When Eclipse is restartet the plugin should be available. Otherwise you should check your plugin configurations to enable the plugin or to check for any errors.