Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

HTML question


  • Please log in to reply
8 replies to this topic

#1 xXAlphaXx

xXAlphaXx

  • Members
  • 867 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:North Carlona
  • Local time:02:56 AM

Posted 31 December 2008 - 04:16 PM

Hello, I'm trying to link to a page outside of a folder, is that at all possblie?

Like on my page located at /Folder/page.html I want it to link back to index.html outside of FolderA
If I am helping you and I do not respond within 24 hours, please send me a PM. :)

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:12:56 AM

Posted 31 December 2008 - 07:19 PM

Yes. When you create the link, you just need to go up from the directory that you are in, then drill down to the directory that you want to go. For instance, something like href="../../newFolder/other.html would go up two directory levels, then go into the 'newFolder' directory, then load 'other.html'. Depending on the server software that you are using, the directory structure that you are using, etc., the number of levels that you may have to go up may vary. For instance, if I am running XAMPP, my html files will be contained within a folder under wampp/htdocs/someProject, so I would have to go up 3 levels to get to the root directory, which would make my path something like href="../../../newFolder/other.html, assuming that 'newFolder' was contained within my c drive.

Alternatively, I think you could use href="file:///C|\newFolder\other.html. This should allow you to use files from other drives if necessary. I can't say for sure because the better practice is to keep the necessary files in a central place. I do realize that there are instances in production where files may be scattered though.

#3 xXAlphaXx

xXAlphaXx
  • Topic Starter

  • Members
  • 867 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:North Carlona
  • Local time:02:56 AM

Posted 31 December 2008 - 08:13 PM

I don't think I quite under stand you.

I'm trying to link from page.html as shown --> /folderA/folderB/page.html

Back to my index.html which isn't in any directory, its before folderA
(Would this be considered the "root" directory?)

Edited by xXAlphaXx, 31 December 2008 - 08:15 PM.

If I am helping you and I do not respond within 24 hours, please send me a PM. :)

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:12:56 AM

Posted 31 December 2008 - 08:23 PM

What does your directory structure look like, going from the base html, to the html to which you want to link?

#5 xXAlphaXx

xXAlphaXx
  • Topic Starter

  • Members
  • 867 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:North Carlona
  • Local time:02:56 AM

Posted 31 December 2008 - 11:35 PM

Okay, its somewhat like this

C:/Website/index.html <---- page I want to link too

C:/Website/Folder/page.html <--- Page I am linking from

If I'm not being clear enough, I want to place a hyper link that will allow me to go from page.html to index.html when clicked.
If I am helping you and I do not respond within 24 hours, please send me a PM. :)

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:12:56 AM

Posted 01 January 2009 - 12:58 PM

I understand. Then your link should be something like: href="../index.html

Are you not understanding what the ../ does?

#7 xXAlphaXx

xXAlphaXx
  • Topic Starter

  • Members
  • 867 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:North Carlona
  • Local time:02:56 AM

Posted 01 January 2009 - 10:25 PM

No I don't think I do...
If I am helping you and I do not respond within 24 hours, please send me a PM. :)

#8 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:12:56 AM

Posted 01 January 2009 - 11:08 PM

The ../ tells the program to go up one directory level. The file that you start in is one directory level below the one that you want to go to. If they were in the same directory, you would simply do href="index.html. By doing it the way I showed you, then the server is instructed to go up one level in the directory, and then look for the file there.

#9 xXAlphaXx

xXAlphaXx
  • Topic Starter

  • Members
  • 867 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:North Carlona
  • Local time:02:56 AM

Posted 06 January 2009 - 01:13 PM

Ahh okay, I got it. Thanks :thumbsup:
If I am helping you and I do not respond within 24 hours, please send me a PM. :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users