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

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

Including & Rendering: html file is showing white screen

I've created the templates folder, I've copied the html into the new html file inside the templates folder. The contact page is rendering, just the html one isn't unless I type /index.html in the viewer Here is my code:

<?php
require '/vendor/autoload.php';
date_default_timezone_set('Australia/NSW');

$app = new \Slim\Slim();

$app->get('/', function() use($app){
    $app->render('index.html');
    });

$app->get('/', function() use($app){
    $app->render('contact.html');
    });

$app->run();

MOD edited to format code

3 Answers

kabir k
PLUS
kabir k
Courses Plus Student 18,036 Points

In the rendering for the contact.html page, do

$app->get('/contact', function() use($app){
    $app->render('contact.html');
    });

You are currently sending / to two different places.

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

I don't know how I missed that! I've fixed it but the white screen is still there. I think I might have to start over:(

I am trying to help another student figure this same issue out in another thread. Let me link it and maybe we can figure it out together.