Worqy Posted February 24, 2010 Share Posted February 24, 2010 Hello. I use XAMPP, and lets say I have one file here: XAMPP/htdocs/file1.php and another one here; XAMPP/htdocs/files/file2.php Now for "file1" to go to "file2" i just use this code "files/file2.php" but if I want to go from "file2" to "file1". Something like: "Jump backwards/file1.php" Need answer ASAP //K Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/ Share on other sites More sharing options...
teamatomic Posted February 24, 2010 Share Posted February 24, 2010 ./file //file is here ../file //file is up one directory ../../file //file is up two directories HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1017681 Share on other sites More sharing options...
Worqy Posted February 24, 2010 Author Share Posted February 24, 2010 ./file //file is here ../file //file is up one directory ../../file //file is up two directories HTH Teamatomic But If I want to go down one directory? Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1017684 Share on other sites More sharing options...
teamatomic Posted February 24, 2010 Share Posted February 24, 2010 use a foldername/path HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1017702 Share on other sites More sharing options...
Zane Posted February 24, 2010 Share Posted February 24, 2010 If you put a slash at the very beginning.. you can make an "absolute" path.. (not exactly absolute) for instance.. if you're link path points to "/htdocs/file1.php"... then that link will work ANYWHERE on that server, because it's explicitly put. on the other hand.. if you don't push a slash in the beginning. It will look for a folder named htdocs in the current directory the file is in. I'm not sure if this method will work on Windows or not though.. haven't tried. Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1017704 Share on other sites More sharing options...
Worqy Posted February 25, 2010 Author Share Posted February 25, 2010 If you put a slash at the very beginning.. you can make an "absolute" path.. (not exactly absolute) for instance.. if you're link path points to "/htdocs/file1.php"... then that link will work ANYWHERE on that server, because it's explicitly put. on the other hand.. if you don't push a slash in the beginning. It will look for a folder named htdocs in the current directory the file is in. I'm not sure if this method will work on Windows or not though.. haven't tried. What if I upload it on a web host. I cant write: C:/Xampp... there. Whats the code then? Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1017995 Share on other sites More sharing options...
Worqy Posted February 25, 2010 Author Share Posted February 25, 2010 Anyone with some idea? I can give you a new example: File1 = C:\Xampp\htdocs\Game\S1\main.php File2 = C:\Xampp\htdocs\Game\logout.php How can I make a href to file 2 from file 1? Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1018187 Share on other sites More sharing options...
wildteen88 Posted February 25, 2010 Share Posted February 25, 2010 If you're making a link to file2 in file1 <a href="/Game/logout.php">Logout</a>'; OR <a href="../Game.logout.php">Logout</a>'; If you going to file1 in file2, you use <a href="/Game/S1/main.php">Home</a>'; Link to comment https://forums.phpfreaks.com/topic/193269-directory-help/#findComment-1018192 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.