$json2 = file_get_contents($GLOBALS['URL'] . 'app/getUsrData/' . $id); //$json2=file_get_contents('http://localhost/workspace/eontziApp/app/getUsrData/'.$id); $usr = json_decode($json2, true); $app->render('tmp_config.php', array('nombre' => $usr['mensaje']['Nombre'] . " " . $usr['mensaje']['Apellido'], 'img' => $usr['mensaje']['Profile_ImageURL'])); } })->name('panel'); //Perfil $app->get('/perfil', function () use($app) { require_once 'Modelos/Trabajador.php'; if (!isset($_SESSION['id_usuario'])) { //render login $app->redirect($app->urlfor('Inicio')); } else { //Coger el idUsuario y consultar todos los datos y pasarlo al template $id = $_SESSION['id_usuario']; $res = Trabajador::getTrabajador($id); $app->render('tmp_perfil.php', array('res' => $res)); } })->name('perfil'); //ruta DEMO $app->get('/demo', function () use($app) { $_SESSION['id_usuario'] = 1; $_SESSION['cliente_id'] = '2'; if (!isset($_SESSION['id_usuario'])) { //render login $app->flash('message', "Debe iniciar sesión para acceder."); $app->redirect($app->urlFor('Inicio')); } else { $id = $_SESSION['id_usuario']; $json = file_get_contents($GLOBALS['URL'] . 'app/getAllPos/?id=' . $id); $json2 = file_get_contents($GLOBALS['URL'] . 'app/getUsrData/' . $id);