Jump to content

php include relative or absolute path

Recommended Posts

I use Dreamweaver as my IDE for development, something i have always found to be a pain but haven't had much time to look into is the best way to include or require a file in other directories and have the intellasense still work for custom classes


and then to add a bit more these files that have the include or require code are also in files that sit in the root and have them as include or require - so i just set up a define ROOT but then I loose all intellasense which comes in very handy when working with a large amount of custom classes and their functions / methods


any solutions to this include or require relative or absolute working in multiple includes throughout a site?


Looking for thoughts, thanks

Link to comment
Share on other sites

Thanks davidannis for your reply,

I use a config.php file also, everything works fine with my define paths, the sites always work fine, I guess I am just trying to seek out a way to have intellasense work correctly in Dreamweaver when you got /pageA.php in the root with /include/pageB.php included in /pageA.php and /classes/pageC.php included into pageB.php


so that is:

define Root = dirname(__FILE__);

In /pageA.php -> include(ROOT . "/include/pageB.php");

In /pageB.php -> include(ROOT . "/classes/pageC.php");


All works fine on the server and includes the pages - but in dreamweaver, in order for intellasense to work, the above include will not work to show the class and its methods as you type/create the code -> they need a relitive path without the var ROOT as this doesn't get defined until runtime on the server


Just wondering if anyone knows a work around for this or something that can be defined in Dreamweaver,


Any thoughts on the best IDE with intellasense like this and a good all around solution for creating sites - I am going to check out a few and a few pointers in that direction would be good too, going to check out Aptana Studio 3 and see what that offers


again, any thoughts would be great

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.