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 trialDomnick Knowlton
Courses Plus Student 2,437 PointsPHP Shopping Cart
The shopping cart is gone, there is only two blank lines next to it.
Here is my PHP code. <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 ($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>
<li class="cart"> <a target="paypal" href="https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=SSSE2YDDZ4DVU&display=1"> </a> </li>
</ul>
</div>
</div>
<div id="content">
1 Answer
Robert Richey
Courses Plus Student 16,352 PointsHi Domnick,
I see a couple lines that are not escaping quotes. If we want to nest double-quotes inside double-quotes, we have to escape them. Or we can use single-quotes to wrap the whole string, then we don't need to escape the double-quotes.
<?php
$myString = "fish sauce, \"implying\" yummy!";
// or
$myString = 'fish sauce, "implying" yummy!';
?>
There is, however, a difference between strings with single-quotes and strings with double-quotes. This gets into interpolation which I think is explained well here.
As for the fix, here are the lines I noticed:
// before fix
<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>
// after fix
<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 this helps,
Cheers