Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Shirts 4 Mike Template Problem.

Has anybody here completed the Simple PHP Application? I got stuck when it comes to the part whereby Randy teaches on conditionals and adding a CSS class by using an IF statement. I did exactly how Randy showed in the video, but I ended up with this: (http://putramuzhafar.biz/wp-content/uploads/2013/04/treehouse-error.png)

alt shirts4mike

I've already checked the conditional statement and everything but this problem still persist. This only appear on the index.php and there's no problem when I navigate to shirts.php and contact.php

Can anyone help?

11 Answers

Casey Hodgson
Casey Hodgson
2,092 Points

I had this same issue, in the CSS there is a background color that you can remove to stop that from happening.

.section.shirts {
padding-bottom: 42px;
background-color: #fff;
}

It's on line 605. :) Just remove the background-color and save.

I'm not 100% sure if this will bring any future complications or errors, but so far for me, none have appeared.

Hope it helps.

Hey Casey,

Thanks for your help! It worked. I should be wary and take initiative next time to check on the CSS styling and debug from there :laughing:

But nevertheless, it's my first time learning from TreeHouse and it's been great so far, especially the help from this interactive forum. Once again, many thanks, Casey. Really appreciate your kind gesture :smiley:

Casey Hodgson
Casey Hodgson
2,092 Points

Excellent. I'm delighted to be of service, and glad you find treehouse just as amazing and friendly and as helpful as I and many others do!

I wish you all the best and happy learning! :)

:thumbsup: Wishing you all the best in your learning journey as well.

Talk soon, -- Putra Muzhafar

I drove myself crazy trying to figure out what was going wrong with this today. Thanks for the tip!!

Hey Hannah!

That's what I did too! I thought it had something to do with the PHP code we wrote or something. Kinda weird nothing happened to Randy's template in the video.

But anyways, glad this thread helps others too!

Cheers!

  • Putra Muzhafar
Antony Wright
Antony Wright
6,525 Points

I have to same problem but both pages, shirts and contact are underlined on the index page.. My code looks exactly the same. Any ideas would be appreciated??

Hi Antony Wright !

Did you write the PHP code in the styles attribute the way Randy typed in? So far, this would be my guess to your issue.

Hope this helps!

-- Putra Muzhafar

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

I think the issue here is that the $section variable is not defined in index.php. It includes header.php, which has a conditional that checks the value of this $section variable. If you are using XAMPP, I think this generates a warning that messes with the styling. (MAMP does not produce this warning.) You should be able to fix it by changing these three lines in index.php ...

<?php 
$pageTitle = "Unique T-shirts designed by a frog";
$section = "home";
include('inc/header.php'); ?>

... to this (adding a new line between the second and third lines) ...

<?php 
$pageTitle = "Unique T-shirts designed by a frog";
$section = "home";
include('inc/header.php'); ?>

I apologize for the trouble there. The project code available for download has that correct, but I can't seem to find it in the video. I'll see what I can do to get that updated.

Antony Wright
Antony Wright
6,525 Points

Hi, I added the $section = "home"; into the index.php and it worked fine. I was a little unsure if this was correct though as it wasnt in the video. Thanks for your prompt reply :) Im enjoying this course, its well presented and after years of building websites with just html &css i can stop copying/pasting code!

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Cool! I'll see what I can do to get that added to the video shortly. I apologize for the error there.