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 trialJuan Davin
1,476 PointsCant pass the previous question, preview said 'cant find favorites.php'
is there an error?
Justin Behnke
4,326 PointsI stop going by the result of the "TEST" and go only by the result of the preview. If it previews correctly you did good and move on... some of those just aren't working.
7 Answers
Daniel Baker
3,198 PointsThe instructions state that the favorites.php file is in the current directory. For files in the current directory you simply include the file name [<?php include 'favorites.php';?>] instead of the previous example that were in the "inc" directory [<?php include 'inc/favorites.php';?>].
David Grimm
12,532 PointsExactly the same happened to me, but then I noticed I've forgotten semi-colon at the end of the statement.
The preview seemed OK, but evaluation wouldn't let you through. After adding semi-colon, it was OK.
The evaluation is quite rigid, but I don't think that one should just give up on it, just because you migh think you have it right according to the Preview :)
nico dev
20,364 PointsThat's the right attitude! Cheers!!
Hermann Azong
3,176 Pointsplease post your code here, so that we can see what you are doing wrong. As Leonardo and Daniel said, since the 'favorites.php' file is in the same directory, you just have to include it by adding the following code to your current file: <?php include('favorites.php'); ?>. This code should be placed below the heading <h1></h1> tag.
christopher vaughan
1,411 Pointssome of these php code challenges are broken. I just tested this one and even when I can see the preview with the included file, it still says its not included when I click check work. I've noticed several of these types of issues with the php code challenges.
Sean Habel
4,407 PointsA lot of these php challenges are very fidgety even though
<?php INCLUDE 'favorites.php'?>
Will in fact output the correct code in the output.
However,
<?php INCLUDE 'favorites.php';?>
is the answer they are looking for under the <h1></h1> tag. Note the subtle difference of the semicolon ';' after the php statement.
Kat Cuccia
786 PointsIf you didn't put a semicolon after the include function, it won't pass you, even though you can see the file in the preview
Leonardo Da Costa
Front End Web Development Techdegree Graduate 14,559 PointsBelow the <h1> tag:
<?php include 'favorites.php'; ?> // since its in the same directory, you can just insert the php file
Is that what you put ? I hope I could help, good luck.
Jeen Xavier
1,086 Pointsyou need to enter your code in between the <h1> </h1> tag your code should be like <?php include 'favorites.php '; ?> it should come correct
oussama benchkroune
Courses Plus Student 1,109 Points<?php include 'favorites.php';?> afther the heading tag "<h1></h1>" Good luck
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsHenrik Christensen
Python Web Development Techdegree Student 38,322 PointsTry add your code and the instruction(s) for the challenge?