I’m learning about PHP classes and objects right now so to get some experience with it, I’m converting my site using these instead of static html to save me typing the same generic html over and over again.
So, this is part of the object:
<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SERVER['DOCUMENT_ROOT']."/main.css\" />
…which produces this in the browser (after I changed the root directory in the Apache config file):
<link rel="stylesheet" type="text/css" href="C:/wamp/www/test/main.css" />
My problem is that the styling in that css file isn’t showing on the page. If I copy the location of the css file shown in the browser (when clicking ‘view source’) and enter it into the url bar, the css file appears. So if I can access it this way, why can’t the webpage access it? I’m assuming it has something to do with permissions but if I right-click on the css file in my file browser, it says that everything can at least read it…
Any help would be greatly appreciated.
Save yourself some effort. This works just as well:
This assumes, of course, that the CSS file is in the document root.