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 trial

PHP PHP Basics PHP on the Web Including PHP

favorites.php file does not exist

Hi,

I have run the script: <?php include 'inc/favorites.php'; ?> below the heading 'A Few of My Favourite Things'. However because the file favourites.php doesn't actually seem to exist the code will not run.

Can you help please?

Thanks

Dave

index.php
<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>

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You've included a favorites.php from inside a folder called "inc". However, for the challenge this folder doesn't exist. Try removing the "inc" folder and just include the file. In this scenario it's located in the current directory. Hope this helps! :sparkles:

Hi Jennifer,

Thanks for your response, you were absolutely right.

Thanks

Dave

Josh Foster
Josh Foster
8,896 Points

The include function takes arguments within parentheses. Your included file must be contained within parentheses like this: <?php include('inc/favorites.php'); ?>. Hope this helps.

Hi Josh,

Thanks for the advise.

Dave