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 trialIulian Mirzac
3,083 PointsParse error: syntax error, unexpected '<', expecting end of file in /home/treehouse/workspace/catalog.php on line 4
I am running this website building course. I am getting stuck onto an apparent simple error to be solved but i can't get to figure it out what the solution might be.
Here's the snapshot of the workspace. https://w.trhou.se/m2f0jk4qia
Of anyone can help i would be grateful.
3 Answers
Mikkel Rasmussen
31,772 PointsYou need to close your php tag at the top of your catalog.php file or remove the <?php.
Matthias Margot
7,236 PointsYou can nest PHP code in an HTML file however HTML syntax is not included in PHP and can't be interpreted as such inside a php tag.
<?php /*(DO NOT WRITE PLAIN HTML IN HERE ONLY OUTSIDE OF THIS)*/ ?>
If you wanted to print HTML to the file from a php code snippet you'd have to use any of the print functions like 'echo', 'print' or 'printf' and your HTML would have to be output as a string, not as plain HTML, php can't read that.
Iulian Mirzac
3,083 PointsI can't belive i wasted so much time on that. I thought about it, then took a glance over the code and i thought i closed the tag below. Thanks to you guys it works now.