Hi i am developing a webapp where i have user slim framework for routing and twig for frontend templating. I am working on social login module where after authentication an want the user to be redirected to dashboard section. I got stuck at the point of rendering. What i have to do is to call the method named channels.list shown below from another method written below this method:
$app->get('/', function() use ($app){
$templateData = [
'pageTitle' => 'Channels'
];
$app->render("routes/channels/list/list.twig", $templateData);
})->name('channels.list');
but when i tried calling the channels.list from my login's get request i am getting loader error.
I am calling it in this way from my login request:
$app->get('/log-in/:type', function($type) use ($app, $hybridauth) {
if ($type == 'Facebook') {
$user = callSocial($app, $hybridauth); // function call for social login
$email = $user->email;
$displayName = $user->displayName;
$db = $app->db->users;
$userData = $db->find(array('email' => $email))->count();
if ($userData == 0) {
// insert user segment
$template = 'channels.list';
$app->render($app->urlFor($template));
} else {
//update the last login time
$template = 'channels.list';
$app->redirect($app->urlFor($template));
}
} else {
$templateData = [
'pageTitle' => 'Log In',
'UI' => [
'noSidebar' => true
]
];
$app->render("routes/log_in/log_in.twig", $templateData);
}
})->name('logIn');
Is there any other way to call or method to call. I hope the question got cleared because i an new to slim that uses twig as a templating engine.
Note: : I can not call the twig file associated with the channels list view as some pre processing is associated with the php file that renders the twig view.