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 trialMiguel Nunez
3,266 PointsAnswer to this code challenge so I can study this.
Within the current directory, I have created a file named favorites.php that displays a few of my favorite things. Add the php code blocks and include that file so that my favorite things display below the heading.
<html> <head> <title>A Few of My Favorite Things</title> </head> <body> <h1>A Few of My Favorite Things</h1> </body> </html>
This is my answer don't know why i'm getting this wrong.
<html> <head> <title>A Few of My Favorite Things</title> </head> <body> <?php include 'inc/favorites.php';?> <h1>A Few of My Favorite Things</h1> </body> </html>
<html>
<head>
<title>A Few of My Favorite Things</title>
</head>
<body>
<h1>A Few of My Favorite Things</h1>
</body>
</html>
8 Answers
Matthew Carson
5,965 PointsYour include function should be on line 7, below the <h1>.
Also, the file is located in the same directory as the .html file. It isn't in an inc/ directory.
On line 7 of the challenge:
<?php include 'favorites.php'; ?>
Leah Haist
20,547 PointsThis is the correct answer: <?php include('inc/favorites.php'); ?>
rahul chopra
Courses Plus Student 466 Points<?php include 'favorites.php'; ?>
Collin Retkowski
6,542 Points<?php include 'inc/favorites.php'; ?> GOES ON LINE 8 NOT 7!
Farai Zuva
6,054 Points<html> <head> <title>A Few of My Favorite Things</title> </head> <body> <h1>A Few of My Favorite Things</h1> <?php include 'inc/favorites.php';?> </body> </html>
Sascha Cajandig
4,033 PointsI know this is old but I am so confused why we need the ; when it runs just fine without. Even in the work that we did in index.php project prior to the challenge, it was never instructed to use the ;. UGHHHHHHHH -__-
Wakurawarerwa Jonah
1,390 Points<?php include 'favorites.php'; ?>
Rajnish Kumar
41,092 Points<?php include 'favorites.php'; ?> not correct
Mercy M Nyamadzawo
2,399 Points<?php include 'inc/favourites.php'; ?> this is taken as wrong. What is the correct way
Farai Zuva
6,054 Points<html> <head> <title>A Few of My Favorite Things</title> </head> <body> <h1>A Few of My Favorite Things</h1> <?php include 'inc/favorites.php';?> </body> </html>