Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End CSS & Images breaking on file inclusion

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41713
    trollster
    Member

    Hello all,

    I’ve built this site and layout using bootstrap. [Test Page](http://ankursinha.net/test/ “”) . I’ve broke the index file into head.php (contains the whole html head like scripts, meta, link rel, etc), then header.php (contains the logo, search bar, etc), then navbar.php (contains the navbar), and the footer. I’ve placed an index file along with it and I used: include ‘head.php’, etc and got it working. But when I created a folder forums, added the same code, but used include ‘../head.php’, etc all the content came, but the css and the image logo didn’t appear. I saw the page source for both the links are the same. Here is the link. [Forums page with same code](http://ankursinha.net/test/forums/ “”)
    The codes for both are the same, just that I added two dots to traverse back to the parent directory and include files under the forums folder, the source shows everything is included but the css and images do not appear. Please help.

    Thank you

    #119609
    David_Leitch
    Participant

    I’m not sure if this is the best or most maintainable solution, but you could use URLs that are relative to the root of the web site, rather than relative to the current page. This is done using a forward slash at the beginning of the URL.

    rather than

    #119664
    __
    Participant

    I *always* use root-relative URLs, for this very reason.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.