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 trialShantanu Trivedi
826 PointsBoth shirts and contact are underlined..
okay I have followed the full instructions. But both Shirts and Contacts are underlined. I don't see it is wrong as we have told to add variable section and put it equal to shirt and contact.
In the header file we, have used if variable section is equal to Shirt and Contact then put a underline..So obviously both will be underlined.
Maybe I am not seeing it clearly, please help-
?php $pageTitle = "Mike's Shirt"; $sections = "Shirts"; include('inc/header.php'); ?>
<div class="section page">
<h1>Mike’s full catalogue of Shirts.</h1> </div> </div>
<?php include('inc/footer.php'); ?>
<?php $pageTitle = "Contact Mike"; $section = "Contact"; include('inc/header.php'); ?>
<div class="section page">
<h1>Contact</h1>
</div> </div>
<?php include('inc/footer.php'); ?>
html> <head> <title><?php echo $pageTitle; ?></title> <link rel="stylesheet" href="css/style.css" type="text/css"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css"> <link rel="shortcut icon" href="favicon.ico"> </head> <body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Shirts 4 Mike</a></h1>
<ul class="nav">
<li class="shirts <?php if($sections == "Shirts"){ echo " on"; }?> "><a href="shirts.php">Shirts</a></li>
<li class="contact <?php if($section == "Contact"){ echo " on"; }?>"><a href="contact.php">Contact</a></li>
<li class="cart"><a href="#">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">
2 Answers
Rich Bagley
25,869 PointsHi,
Just want to confirm you have this at the top of your shirts.php file:
$section = "shirts";
and this at the top of your contact.php file:
$section = "contact";
They shouldn't both be in the files. One for each and notice the singular. In your example you have $section in some instances and $sections in others.
You then have the following part in your header.php file:
<li class="shirts <?php if ($section == "shirts") {echo "on";} ?>"><a href="shirts.php">Shirts</a></li>
<li class="contact <?php if ($section == "contact") {echo "on";} ?>"><a href="contact.php">Contact</a></li>
Hope that helps.
-Rich
Alena Holligan
Treehouse TeacherYou need to define the $section variable in your index.php file as well. Add the following line after the $pageTitle:
$section = "home";
Leslie McPhail
14,270 PointsLeslie McPhail
14,270 PointsHi Shantanu - One issue may be the variable, as it looks like in one area you are calling the variable $section, and in another area you have made it plural as $sections. Change the plural version to $section in both the line item php and the header php, refresh, and see if it fixes the underline issue.