Ben Os20,008 Points
My catalog items appear as a long list and suddenly there is no CSS in the site
I am doing the third PHP course and bulding my first non-cms PHP site. I have a very minimalist code (thanks to Alina Holligan) and I seem to did everything right so there are no PHP errors; Till now I also didn't have any CSS-related problems and this is the first time such a thing happens:
For some reason my catalog items appear as a long list and there is no CSS in the site.
Edit: Here are all my codes in one segment:
And here is a link to my Treehouse site:
Dani BachourPro Student 1,977 Points
You forgot to include("inc/header.php"); inside your index.php
Elian Kloppenburg22,902 Points
I do not see any link to your CSS sheet in there. So the HTML will be styled without it. It probably belongs in your header.php file ( although not sure, did not take this course yet ) so be sure to check for it.
Hi Ben, I hope you got your issue resolved.
When you put the catalog.php file within a sub-directory then the css and img also fail.
I was wondering if there was any code that I would have to modify for this to work.
I have tried the standard ../ beforehand, but the inc file is meant to contain files for a whole site and many large sites have sub directories.
Brian Gilligan1,540 Points
I had this same issue! It took me forever to find out what was causing it! When I downloaded the data.php file and cut and pasted it in, it didn't include the <?php tag on line 1. Once I added this to the top of the data.php file, it worked again! I hope this helps! Example: <?php //<---THIS IS WHAT WAS MISSING $catalog = [ "title" => "A Design Patterns: Elements of Reusable Object-Oriented Software", "img" => "img/media/design_patterns.jpg", "genre" => "Tech", "format" => "Paperback", "year" => 1994, "category" => "Books",