I've built a site where I have a header.php file, index.php and footer.php. In the header.php file I am calling the .css files that I am using, which live in the root directory. I then have my work pages, which live in their own folders and each have an index file (mountain_bike/ is a folder that lives on the root with an index.php file for the mountain bike page). For some reason when I do this, I can access the same header and footer files despite being in the folder, but the css file is not being read. Is there another step I should take or another way of going about this? Thanks.
The header file and css files live on the root. The mountain_bike/index.php is still using the same header file as the home page. So I did this..
PHP Code:
<?php
include("../header.php");
?>
The header and footer both are linked to the mountain_bike/index.php, but the CSS is not being applied.
Sorry if I'm duplicating efforts, wasn't sure what you meant.
Well It could be two things then.
1. the href isn't correct.
2. the php isn't referencing it correctly.
In either case, you can use the EXACT location.
i.e your website/location of file moving from the root.
First make sure the href is referencing it correctly.
If you narrow it down to the php, try using exact location.
Or even try using inline to make sure the css is correct.
Ok thanks. One other thing, could it be the fact that I'm building this site in a DEV folder? So I guess it's not actually on the root, but it's all inside the DEV.
So I moved everything to the root and still nothing. Everything works fine if I have example.php, header.php and style.css living in the same directory. Example.php is calling header.php which calls style.css. As soon as I move example.php into a folder example/index.php the style sheet stops working. The header still works, I'm calling
PHP Code:
<?php
include("../header.php");
?>
I don't know if I'm missing something. It seems pretty straight forward but not working. The href is right and php looks right too.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks