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 Building Websites with PHP Slim Basics & Twig Templates Layouts with Twig

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

Getting a 404 page after creating contact.twig

I placed the follow code in a new file in my templates folder and named it contact.twig. I also changed the second app->get to have 'contact.twig in it, but I'm getting a 404 page not found error when I got to my contact page.

{% extends 'main.twig' %}

{% block content %}
    <h2>Ralph Waldo Emerson</h2>

    <p>Unfortately, Ralph Waldo Emerson has been deceased for over 100 years so he's not particularly expediant at replying to email but you can make an attempt below. However, if you require face to gravestone contact you can visit his remains at:</p>
      <h4>Sleepy Hollow Cemetery</h4>
      <p>34 Bedford Street<br>
      Concord, MA 01742, United States<br>
    <a href="https://www.google.com/maps/place/Sleepy+Hollow+Cemetery/@42.464126,-71.343098,15z/data=!4m2!3m1!1s0x0:0x9c41d0f83df689a6?sa=X&ei=ZCgLVZb5Io_hoASc7oHwCQ&ved=0CH0Q_BIwCw">Google Map</a></p>

        <input type="text" placeholder="Full Name">
        <input type="email" placeholder="Email Address">
        <textarea placeholder="Your message..."></textarea>
      <input type="submit" class="button">
{% endblock content %}

2 Answers

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

Thanks Shadrack Ndacayisenga. It turn out this is supposed to happen. In the next video he shows you that you need to change the url.

make sure to use the right route

$app->get('/contact', function() use($app)){