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 Enhancing a Simple PHP Application Cleaning URLs with Subfolders Server Paths and Constants

Challenge Task 2 of 3, I'm including ("../../htdocs/config/company.php"), but the quiz is saying it can't locate it.

The challenge asks for a relative server path to the file htdocs/config/company.php. I've included what I feel should be the appropriate relative path (along with many variants that have been unsuccessful). Any ideas what I'm doing wrong?

<?php include("../../htdocs/config/company.php"); ?>

about/leadership/index.php
<?php
include("../../htdocs/config/company.php");
?>

<html>
<head>
     <title>Leadership | Shirts 4 Mike</title>
</head>
<body>

    <h1>Leadership</h1>
    <p><strong>Owner:</strong> ????</p>
    <p><a href="/contact/">Contact</a></p>

</body>
</html>

1 Answer

Jeff Lemay
Jeff Lemay
14,268 Points

You did not need to include htdocs in your relative path, since the file you are including from is already in that directory.

I think this is what you are looking for (allow I don't know your whole folder structure):

<?php
include("../../config/company.php");
?>

This will take you out of the leadership folder ( ../ ), then out of the about folder ( ../ ), then into config where the file you want resides.

Jeff Lemay
Jeff Lemay
14,268 Points

EDIT: although not allow**

Milo Winningham
seal-mask
.a{fill-rule:evenodd;}techdegree
Milo Winningham
Web Development Techdegree Student 3,317 Points

This is correct, but there's a problem with the Code Challenge at the moment that's preventing the correct answer from working.

I'll see about getting this fixed, but until then the path ./config/company.php seems to work.