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
https://forums.phpfreaks.com/topic/275930-php-include-relative-or-absolute-path/
Share on other sites

Not sure about Dreamweaver, but I have a convention of having three servers dev.mydomain.com, test.mydomain.com, and the live server. I include a config.php that looks at the URL and defines paths, directories, database connections, etc. for each environment.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.