im using slim for the first time and want to know why i get undefined in $file variable. Do i have to add the variables to the container or how it works? How the cycle works?, neither work if i add var_dump inside the get.
In another area of the site i use define, but i think it´s not the best way.
Hope you can help.
$app->get('/path/{id}-{title}', function ($request, $response, $args) {
switch ($args['id']) {
case '1':
$file = 'pathtofile';
break;
case '2':
$file = 'pathtofile2';
break;
}
var_dump($args);
return $this->view->render($response, $file.'.html', [
'id' => $args['id'],
'title' => $args['title']
]);
})->setName('path');
Thanks