Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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...