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:
``
but they're giving me errors. It can't seem to find the files:
Quote: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?
Aha! It seems PHP doesn't process relative links the same way html or css does. Typically a leading "/" sends the file system back to the root, but not with php. Using the $_SERVER["DOCUMENT_ROOT"] constant solves this problem.
Yes and no.
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.