How to render Dashboard after login, in Slim Framework route?


I’m using the following route , after email and password verification i want to display the “dashboard.php” templete , … //which folder should have “dashboard.php” file be ?
$app->post(’/userlogin’, function () use ($app) {
verifyRequiredParams(array(‘email’, ‘password’));
$email = $app->request->post(‘email’);
$password = $app->request->post(‘password’);
$db = new DbOperation();
$response = array();
$res=$db->userLogin($email, $password);
if ($res==0) { // verifying email and password
$app->render(‘dashboard.php’); //which folder should this template be ?
I have the following Error …
Type: RuntimeException
Message: View cannot render dashboard.php because the template does not exist
File: C:\xampp\htdocs\serverSideAdmin\libs\Slim\View.php
Line: 272


Hi, I think the convention is to use /resources/views and have a layout folder in views folder for the master template. However there is no correct folder it’s up to you, have you looked at this it shows how to work with both Twig and PHP views:

I use MVC in my Slim apps so my code looks like this:

    return $this->view->render($response, 'admin/dashboard.twig');

Also take a look at