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

Ben Os
Ben Os
20,008 Points

2 broken links in a test site after I tried to render page with Slim PHP MF

2 links in my Slim-PHP main menu are broken even though I believe I followed the teacher to the letter...

Here is the home page:

http://port-80-4fvfqngcqw.treehouse-app.com/

Here is a snippet of the relevant code, followed by a direct snapshot:

$app = new \Slim\Slim();

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

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

$app->run();

https://w.trhou.se/i2fmotknmd


Note: both index.html & contact.html are in a folder called "templates". I tried to change the paths inside the two functions but it didn't help.

Alena Holligan
Alena Holligan
Treehouse Teacher

In your templates folder, index.html and contact.html have <nav> in two places in each file. These should link to your routes not the html files.

Change your code to the following:

  <nav>
      <a href="/" class="selected">About</a>
      <a href="/contact">Contact</a>
    </nav>
Ben Os
Ben Os
20,008 Points

So much thanks to you Alena !

I would humbly suggest to add a note in the "teachers note's" that the <nav> tag should be checked if everything worked but the menu in the end...