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 trialNicole Archambault
27,853 PointsAdd a 'get' route to 'index.php'
Based on the code I used (successfully) in my actual Twig page, I feel like this should work. However, I'm getting the not-so-helpful "Bummer! Try again!" message. Can anyone spot my mistake?
<?php
require 'Slim.php';
$app = new \Slim\Slim();
$app->get('/hello', function() use($app) {
$app->render('index.php');
});
$app->run();
3 Answers
Ted Sumner
Courses Plus Student 17,967 Pointstry removing the semicolon after the $app->render line.
Nicole Archambault
27,853 PointsThanks Ted - they didn't want that line at all, apparently, so it worked after deleting it. :)
Preston Yeschick
10,803 PointsRemoving the $app->render line worked for me too.
Ted Sumner
Courses Plus Student 17,967 PointsThis code passed for me:
<?php
require 'Slim.php';
$app = new \Slim\Slim();
/* add your code below this line */
$app->get('/hello', function() use($app){
echo 'Hello There';
});
/* add your code above this line */
$app->run();
The first part of the challenge was to add $app->get('/hello');
. The second part added the remainder of the $app->get
line. I didn't have to remove anything from the code. I was just careful to add only what I was instructed to by the step of the challenge. The challenge never said to add a render line. The second step said to add an echo line.
Nicole Archambault
27,853 PointsNicole Archambault
27,853 PointsJust figured this one out based on another user's experience I had missed... they don't want the app->render line. A bit misleading, indeed.