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 Building Websites with PHP Slim Basics & Twig Templates Including & Rendering

mikkel pohjola
mikkel pohjola
1,966 Points

getting a white screen

Hi i am getting a white screen when running the code

Here is my code

         <?php
   //kalder pƄ autoload filen
require 'vendor/autoload.php';
//Tidszone
date_default_timezone_set('Europe/Copenhagen');
    //$log = new Logger('name');
    //$log->pushHandler(new StreamHandler('app.txt', Logger::WARNING));
    //$log->addWarning('Oh Noes');

    //use \Psr\Http\Message\ServerRequestInterface as Request;
    //use \Psr\Http\Message\ResponseInterface as Response;

    $app = new \Slim\Slim(); 
    //Her laver vi vores indhold til forsiden
 $app->get('/', function() use($app){
    $app->render('index.html');
 });

 //Her laver jeg kontakt siden
 $app->get('/contact', function(){
      echo 'contact us';  
   });

    $app->run();
?>
          ```

1 Answer

Hej Mikkel

On the line:

<?php $app = new \Slim\Slim();

I believe it should be:

<?php $app = new \Slim\App;