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 trialRobbie Thomas
31,093 PointsChallenge 1 of 2
What am I doing wrong?
<?php
require 'Slim.php';
$app = new \Slim\Slim();
/* add your code below this line */
$app->get('/hello', function() use($app){
$app->render('index.php')
};
/* add your code above this line */
$app->run();
6 Answers
Ted Sumner
Courses Plus Student 17,967 PointsRichard, you are still misssing the ) for the $app->get(. It should be:
<?php
$app->get('/hello', function() use($app){ echo 'Hello There'; });
// Notice the ) after the } and before the ;
Ted Sumner
Courses Plus Student 17,967 Pointsyou open the parenthesis for the get but you do not close them. You need to close it like this });
Dale Bailey
20,269 PointsI'm not hot on php but at a glance your first function has no curly braces? or comma if not containing use? so i'd say the problem lies around that line, the get has open parenthesis too?
Richard Cain
Courses Plus Student 9,029 Points<?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
Richard Cain
Courses Plus Student 9,029 PointsReplace this part: $app->render('index.php') With this: echo 'Hello There';
Robbie Thomas
31,093 PointsThanks for the help. I got to get a little better at this.
Ted Sumner
Courses Plus Student 17,967 Pointsone of the key aspects of coding is attention to those little details. A good text editor can really help. They can be setup so if you open a (, {, or[ they will close it for you as well. I really like it.
Robbie Thomas
31,093 PointsI got Sublime Text, but I have been using the Treehouse editor for this PHP Dev class.
Richard Cain
Courses Plus Student 9,029 PointsRichard Cain
Courses Plus Student 9,029 PointsYeah, I missed that when I copied his code over to the comment. It's fixed now, thanks.