Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
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 BachourCourses Plus Student 1,977 Points
You forgot to include("inc/header.php"); inside your index.php
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",