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

devope devope
devope devope
11,490 Points

PHP Fatal error: Call to undefined function render()

  1. I have this index.php
<?php

require 'vendor/autoload.php';

$app = new \Slim\Slim(array(
    'view' => new \Slim\Views\Twig()
));

$view = $app->view();
$view->parserOptions = array(
    'debug' => true
);

$view->parserExtensions = array(
    new \Slim\Views\TwigExtension(),
);


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

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

$app->run();
  1. And get error
This page isn’t working

localhost is currently unable to handle this request.
HTTP ERROR 500
  1. Also in the terminal console I get this Call to undefined function render()

BTW question for teacher and Treehouse platform: what's the problem with this course to resolve it? I see many unanswered questions about the same problems.

Thank you anyway!