If I INCLUDE “header.html” in “index.php” then I thought that it is like “header.html” becomes part of “index.php” and so any references in “header.html” should be based on their relationship to “index.php”?? :-/
In my mind, the reference to my style sheet should be…
Hmm, odd. I would expect that to work too. The code from the include should just become part of the index.php page, as you say.
TBH, I would recommend using the slash before the css folder anyway, as then it works from any page, no matter where in the site. The same goes for the include link:
<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/header.html"; ?>
This can be a pain if you are developing locally, but I recently found that you can set up MAMP (and I presume WAMP etc) so act exactly like an online server—removing “localhost” etc from the url, so that the local setup exactly matches the online setup. It’s very handy.
Any in fact, it seems like it works in some cases but not others.
My head is spinning between NetBeans and my Web Host.
TBH, I would recommend using the slash before the css folder anyway, as then it works from any page, no matter where in the site.
Yeah, but lots of other code examples in my book aren’t that easy.
It is a nightmare trying to learn PHP and debugging the author’s crappy coding style…
(What I need is a PHP “angel” to swoop in and help me work through things…)
The same goes for the include link:
<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/header.html"; ?>
That determines where your web root is at?
This can be a pain if you are developing locally, but I recently found that you can set up MAMP (and I presume WAMP etc) so act exactly like an online server—removing “localhost” etc from the url, so that the local setup exactly matches the online setup. It’s very handy.