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 trialSankara Narayanan
6,038 PointsParse error: syntax error, unexpected 'shirts' (T_STRING) in C:\xampp\htdocs\inc\header.php on line 17
<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>```php
1 Answer
Jeremy Hayden
1,740 PointsDid you close out your php tags? <?php ?>
Looks like both classes have an error on them.
Last line has '''php on the end.
First line has <?php if ($section == "shirts") {echo ("on");}">
But i think you need a ?> in there
<?php if ($section == "shirts") {echo ("on");}?>">
might be what your looking for. Also check second class for same error.
Justin Black
24,793 PointsExactly right. Both lines are missing the closing PHP Tag. When you combine logic with display like this, you always need both tags <?php and ?>. The only time it is not necessary ( and can even help in readability ) is in your business logic.
Sankara Narayanan
6,038 PointsAwesome Thank you so much for taking your time to solve my silly mistake.
Sankara Narayanan
6,038 PointsSankara Narayanan
6,038 PointsDeclared the appropriate variables in the shirts page and contact page. yet i got that error
Please help.