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 Introducing Constants

ROOt_PATH and BASE_URL is not working

Hi All, ROOT_PATH and BASE_URL is not working. i defined them as a constants.However,no luck to get the desired outcome.

I did everythhing like Randy did.

3 Answers

Amy Kang
Amy Kang
17,188 Points

I had to include the config file in the header for it to work.

Put this above the html in your header file:

<?php require_once("config.php"); ?>

Pedro Dasilva
Pedro Dasilva
8,291 Points

Got it !!! Worked like a charm. thanks

Caesar Bell
Caesar Bell
24,827 Points

Good catch. I was having the same issue but it worked for me as well, I forgot that i had the config.php in the same include file as my header and footer.php

I did the modification like you said by including config.php to header.It still doesn't work. I don't know how Randy get it work.

Caesar Bell
Caesar Bell
24,827 Points

send a snipped of your code.

Michael Tigue
Michael Tigue
4,799 Points

I placed this at the top of my header file and it works:

<?php require_once "inc/config.php"; ?>

I had to specify the path to the config file, which included the /inc folder.