OldWolf Posted December 6, 2008 Share Posted December 6, 2008 Background: Whenever I write a package of some kind intended to be included into a bigger piece, I set up a constant for the path to that package, so that when I include files within the package, I can do PATH . 'included.php', when it's located in the root of the package. Problem: The package I'm working on right now will not always be in the same place, so my constant has to be figured out dynamically. Essentially, what I'd like to do is get the path from the original file to the included package. I know there's a simple solution here, but I'm so darn sleepy I just can't think of it! Thanks! Link to comment https://forums.phpfreaks.com/topic/135772-path-issue-im-struggling-with-because-im-tired-p/ Share on other sites More sharing options...
genericnumber1 Posted December 6, 2008 Share Posted December 6, 2008 To get the path of the current executing file you can do <?php dirname(__FILE__); ?> this will get the path of the included file if you use it in an included file. Link to comment https://forums.phpfreaks.com/topic/135772-path-issue-im-struggling-with-because-im-tired-p/#findComment-707460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.