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

Myles Hyson
Myles Hyson
8,853 Points

Using Sublime 3 and can't see Home or contact page.

Using Sublime for this course and I can't see what's wrong with the code. Do I need to do something different since I'm not using workspaces?

<?php

require __DIR__ . '/vendor/autoload.php';
date_default_timezone_set("America/New_York");

// $log = new Logger('name');
// $log->pushHandler(new StreamHandler('app.txt', Logger::WARNING));
// $log->addWarning('Oh No');

$app = new \Slim\Slim();

$app->get('/', function() {
    echo "Hello this is the Home Page";
});

$app->get('/contact', function() {
    echo "Hello this is the Contact Page";
});

$app->run();
?>

And here is my .htaccess file

RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

1 Answer

See your other post. You need use($app) on both of your $app->get lines.