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

Cant get it to work!

Hey Guys, im trying hard but cant get the task to work. Here is my code:

config.php <?php define("BASE_URL","/shirts4mike_local/") ; define("ROOT_PATH","$_SERVER["DOCUMENT_ROOT"] . "/shirts4mike_local/");

receipt.php

<?php

require_once("../inc/config.php");

$pageTitle = "Thank you for your order!"; $section = "none"; include (ROOT_PATH . "inc/header.php"); ?>

<div class="section page">

    <div class="wrapper">

        <h1>Thank you!</h1>
        <p>Danke für Ihre Zahlung. Ihre Transaktion wurde abgeschlossen und Sie erhalten per E-Mail eine Bestätigung für Ihren Kauf. Sie können sich unter <a href="http://www.paypal.com/de">Paypal</a> in Ihr Konto einloggen, um die Transaktionsdetails anzuzeigen.</p>

        <p>Need another Shirt? Check out <a href="<?php echo BASE_URL; ?>shirts.php">Shirts-List</a></p>

    </div>

</div>

<?php include(ROOT_PATH . "inc/footer.php"); ?>

2 Answers

Sorry, wasn ware of the markdown cheatsheet:

my config.php

<?php 
    // Definiert den ServerRoot-Hauptordner als Konstante
    define("BASE_URL","/shirts4mike_local/") ;
    //Definiert den ServerRoot
    define("ROOT_PATH","$_SERVER["DOCUMENT_ROOT"] . "/shirts4mike_local/");

my receipt.php

require_once("../inc/config.php");

$pageTitle = "Thank you for your order!";
$section = "none";
include (ROOT_PATH . "inc/header.php"); ?>


    <div class="section page">

        <div class="wrapper">

            <h1>Thank you!</h1>
            <p>Danke für Ihre Zahlung. Ihre Transaktion wurde abgeschlossen und Sie erhalten per E-Mail eine Bestätigung für Ihren Kauf. Sie können sich unter <a href="http://www.paypal.com/de">Paypal</a> in Ihr Konto einloggen, um die Transaktionsdetails anzuzeigen.</p>

            <p>Need another Shirt? Check out <a href="<?php echo BASE_URL; ?>shirts.php">Shirts-List</a></p>

        </div>

    </div>






<?php
include(ROOT_PATH . "inc/footer.php");
?>

After 1,5 hours I found the error in "$_SERVER. Sorry for bothering!