• syntax of relative reference to a file in root

    Home » Forums » Developers, developers, developers » Web design and development » syntax of relative reference to a file in root

    Author
    Topic
    #416018

    I want to create hyperlynks in page1a.htm and page1b.htm to a page2.htm that will always be in the root of the disk or storage device that has my web pages. Example:

    E:page2.htm
    E:htmlpage1a.htm
    E:htmlexamplespage1b.htm

    I plan to copy everything “as is” (no editing of any kind) to a portable device or CD, flash drive. Therefore, E: will probably be re-assigned any letter name available in the local PC or network drive.

    What would be the correct syntax of the relative reference to a file in the root directory? Can you give me some examples?

    Thank you

    Viewing 0 reply threads
    Author
    Replies
    • #929217

      Given YOUR examples, it seems to me that the correct relative syntax is to simply omit the E: portion of your examples, assuming the subdirectories html and examples do exist. If the pages get placed on a web page in that same manner, I think all one would have to add would be the domain name before the first backslash. Someone jump in if I’m not saying it correctly. I have a dedicated partition called WEB on one of my drives and the file and directory structure mirrors the way my web domain is setup (ALHOFFMAN.ORG) so files on my disk are setup in the fashion you describe and only require “references” to start with the first backslash.

      • #929219

        The web pages are not inteded to be posted in a web site or a web server.

        I plan to use web pages to transport and display different sorts of information in flash drives or CD’s, given that any computer today has a web browser.

        Could you type in some examples? I’ am a begginer with html, and learning the hard way..!

        Thank you

        • #929242

          If you always know the depth of the folder in question, this is easy. In HTML, you can omit any folder name to reference a file within the same folder.

          For any folder above the location of the current page, simply use dot-dot-slash (../) to represent one folder up. You can use multiple dot-dot-slahes for multiple folders above.

          For example, to navigate from C:inetpubwwwrootPage1.htm to:

          C:inetpubPage2.htm = Page 2
          C:Page3.htm = Page 3

          To acces a folder below the current page, simply include the folder name in the link.

          For example, to navigate from C:Page1.htm to:

          C:inetpubPage2.htm = Page 2
          C:inetpubwwwrootPag3.htm = Page 3

          Moving the contents of this path structure to another drive or folder should not change the links – as long as they are still relative to each other (this is the key).

          Hope this helps.

          • #929306

            your examples are excellent ! clapping

            but I need the only one that you did not address:

            go from E:my_webcarspage1.htm

            to E:my_webboatspage2.htm

            can this be done? confused

            THANK YOU

            • #929312

              No problem! bow

              Yes, this can be done. Think of the dot-dot-slash as a way of “traversing folder levels” – in other words, setting a different folder level as the new starting point. So, in your example (E:my_webcarspage1.htm to E:my_webboatspage2.htm) you could use a dot-dot-slash to change your starting point from the cars folder to my_web. Then simply add boats/page2.htm to move down to the boats folder. (Note the use of backslash in the windows environment but the use of forward slash in the web environment.)

              The example would be this:

              From E:my_webcarspage1.htm to point to E:my_webboatspage2.htm
              would be this:
              Page 2

              Hope this helps.

            • #931065

              Great help! bananas

              Thank you.

    Viewing 0 reply threads
    Reply To: syntax of relative reference to a file in root

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: