PHP: include file with dirname(__FILE__) but still get php code assist in Eclipse

648 views Asked by At

In a script I include a php library with :

include_once dirname(__FILE__) . "/lib.php";

This way I don't get code assist for the functions in this library in Eclipse. But if I use :

include_once "lib.php";

code assist does work.

But I want to use dirname(__FILE__) to be sure I'm looking in the right directory for the lib. (this script may be included in another php-script, and then it doesn't work anymore, without using dirname(__FILE__)

Any tips to get code assist working, while still using dirname(__FILE__) ?

1

There are 1 answers

0
sgibly On

In case the file exist in your project (and your project is an Aptana PHP project), you will get the code assist for all the files in the project, no matter if you include or require a file.

In case your files are located outside of your current project (a different project, or somewhere on your disk), you can attach them as an external library.

You can follow the instructions at https://wiki.appcelerator.org/display/tis/PHP+Development#PHPDevelopment-AttachingPHPResources and learn how to do that according to your needs.

Hope that helps.