I'm trying to integrate the style of my gallery into the rest of the site I'm working on. In the rest of the style I use server-side includes to piece together the site (so I can remotely change the navigation bar, etc, all at once). I've changed these from HTML style includes to PHP includes, for instance:
`<?php include("/includes/head.html"); ?>`
but they're giving me errors. It can't seem to find the files:
Warning: include(/includes/head.html): failed to open stream: No such file or directory in /home/*****/public_html/gallery/themes/norrisbowers/index.php on line 14
Any clues what could be going on?
Comments
`
<?php include("../../../includes/head.html"); ?>
`
<?php include($_SERVER["DOCUMENT_ROOT"] . "/includes/head.html"); ?>
Say I'm running a page at www.domain.com/gallery/
I make a link to "/image.jpg"
html/css will try to find an image at:
www.domain.com/image.jpg
php will try to find an image at:
www.domain.com/gallery/image.jpg
Where the slash tells html and css to back up to the root of the directory, php ignores this, interpreting it as just being in the current directory. This is a really nice handy syntax in html/css, but now that I think about it, I don't think I've encountered it in any other languages.
"/directory" really isn't relative OR absolute in html/css, it's sort of like a third type of link, as it's handled quite differently from the above links.
EDIT: Ahhh, I did some research and this is referred to as a "root-relative" link, and is thought of as separate from absolute and relative linking. They are specific to client-side environments (html/css/js). Server-side environments like php/python have no specific concept of the domain root.