Zend Studio is a convenient environment to code in PHP, which is why many Drupal developers are using it. But some settings are necessary to ease its use, due to the specific extensions Drupal uses.
Recognizing Drupal components within the Studio IDE
First things first, chances are you've already noticed Zend Studio didn't consider Drupal .module
, .inc
, or .theme
files to be "Web documents", or even actual PHP, and found how to configure it for them. If you haven't, it's real simple (example given for Zend Studio 5.0.0) :
- Start Zend Studio
- Open the
Tools
→Preferences dialog
- Choose the
File Types
tab - Choose the
PHP files
in the top left list - Click
Add
on the top right button, near theFile type extension
list - Add each extension needed by Drupal:
module
,inc
,engine
,theme
, one at a time. Do not include the dot before the extension - That's it ! You now have access to the full features of the Zend Studio IDE on Drupal components
Generating PHPDocumentor documentation for Drupal components
Zend Studio 5.x comes bundled with PHPDocumentor and some integration work done. while PHPDocumentor is not the standard documentation tool for Drupal, which uses DOxygen instead, it is still very convenient, notably as most tags are compatible between the two systems anyway.
However, Studio does not reconfigure the PHPDocumentor file types, so when you try and generate documentation using Zend Studio's Tools
→ PHPDocumentor
wizard, you'll stumble on this error:
This time the workaround is not within Zend Studio itself: although Zend could have integrated this setting into PHPdocumentor, they didn't do it (yet ?) in version 5.0.0. The setting is located in file <studio directory="">/bin/phpdocumentor/phpDocumentor.ini</studio>
. You can just as well edit it within the IDE while it's up. You'll find it's a vanilla .ini
file, with the files to be processed as PHP source listed in a _phpDocumentor_phpfile_exts
section:
(...skip beginning of file...) [_phpDocumentor_phpfile_exts] php php3 php4 phtml (...skip rest of file...)
All it takes is to add the extensions we need:
(...skip beginning of file...) [_phpDocumentor_phpfile_exts] php php3 php4 phtml engine inc module theme (...skip rest of file...)
That's it ! You can now generate docs for your Drupal code from within Zend Studio. Don't forget to add the comments into your code, now !
Cool, heres a more general
Recognizing Drupal components with Zend Studio for Eclipse
Follow the previous steps, to recognizing Drupal components with Zend Studio for Eclipse you can:
1- Open the Window → Preferences dialog
2- Choose General → Content Types on left list
3- Choose Text → PHP Content Type in the top rigth list
4- Click Add on the top right button, near the File type extension list
5- Add each extension needed by Drupal: *.module, *.engine, *.theme, one at a time.
Regards
Drupal API in Zend Studio for Eclipse
Zend Studio for Eclipse is a great environment for developing Drupal, especially now I've got debugging working locally and FTP sync using Aptana.
Does anyone know how to get the Drupal API included in code completion? I'm gonna look into it but if the reseacrh has always be done...
cheers
Marcus
Drupal API code completion in in Zend Studio
It is available as soon as you create your project from the root of your (multisite) install, just like in PDT and Aptana.
The problem is that in that case you are not working remotely but locally, and syncing to the remote. But it is indeed convenient to have the whole API in autocompletion in Studio.
This being said, I tend to prefer working with the "classical" version of Studio, which can manage remote projects transparently, including autocompletion. Your Zend Studio for Eclipse normally allows you to use the classical IDE too, if you want to try it.