directory navigating

Discussion in 'PHP' started by pHrEaK, Sep 29, 2011.

  1. #1
    I'm having an issue figuring out how to link to my style.css page from within different directories. For example, my style.css page is going to be at the root level or base level (when an end-user types in the url the first directory they are taken to). Now I've got a header.html file that is the code for the header of the site that will be displayed on all of the other pages. In this header.html file i make the call to the style.css page. The problem I am having is that whenever I call the include() function to include this header.html file onto the subsequent pages where ever i told the header.html file to point to for the style.css page is where it's looking for the page. Whenever everything that uses header.html is in the same directory as style.css everything is fine. But whenever a page that is in another directory calls header.html the header.html file still has the relative path for style.css and the page is not displayed correctly because style.css is in a different directory. Using ./ or ../ to navigate will not work because the header.html file is used in multiple directories all on different levels...

    There has to be an easy way to fix this problem but i've been searching around and haven't found the answer yet...was wondering if anyone on here would know?
     
    pHrEaK, Sep 29, 2011 IP
  2. pHrEaK

    pHrEaK Active Member

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    It was brought to my attention that whenever i was using what i thought was absolute path was not. I'm using apache installed locally on my machine and i was assuming that my scripts knew that the htdocs folder was the root path for everything for the site, but i was wrong lol. I put full path in c:\xampp\htdocs\folder\style.css and it works just fine. Whenever i go to upload everything to my serverspace I'll just replace the c:\ path with http://www.sitename\style.css and everything should work properly...I asume.
     
    pHrEaK, Sep 30, 2011 IP