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

PHP Build a Basic PHP Website (2018) Building a Media Library in PHP Including the Header

After copying the files my page does not display correctly.

Hello,

After copying the HTML from index.php to header.php and setting up the suggest.php, my site does not display correctly. There is no more header or navigation on the main page and all of the images are large lining the right side of the page.

If you're doing this in workspaces then you can post a snapshot of your workspace.

If you're doing this locally then you'll need to post the relevant code.

Does your index page work correctly?

5 Answers

Hi Jose,

You have named your include folder "inc.php" when it should only be "inc"

Your include statements can't find header.php because of this.

If you right click over the folder name you should have the option to rename it. Everything should be sorted out once you get the folder properly named.

The styling problems that you had were due to the css not being loaded.

Thank you Jason! I was going to crazy trying to figure out why that wasn't working.

Hello Jason,

Thank you for your response. I have down a snapshot of index.php also, it doesn't appear that my .php is working correctly.

https://w.trhou.se/gi1ulp4hdr

Thank you again,

Jose

Lori Jones
Lori Jones
2,205 Points

Jose, your folder inc.php should be just inc rename it by right clicking on inc.php and select rename then change the title to inc

I am having a problem with display also, but I think that somehow my css is not linking right to the files after creating the header.php.

Edward Starski
Edward Starski
960 Points

I think a big issue is the stylesheet not linking properly because the folder structure of the site has changed. The link to your stylesheet should go back a directory before going into the css directory. Please explain that as a lot of people are confused.

Marius Unknown
Marius Unknown
12,925 Points

Just update header.php style link to this:

<link rel="stylesheet" href="../css/style.css" type="text/css">

As you see I added 'two points' out there.