Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions app/controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ class HomeController extends BaseController {

public function getHome()
{
$fecha=explode(',',date('d,m,Y'));

return $this->renderHTML('home.twig',['saludo'=>"Hola San Juan","fecha"=>$fecha]);
//$fecha=explode(',',date('d,m,Y'));
$alumnos=array('Federico','Fernando','Ismael','Ruben','David','Emmanuel');
//$fecha=new Fecha();

return $this->renderHTML('home.twig' , ['listadoAlumnos'=>$alumnos]);
}

public function getAyuda()
{
// return view('home',[]);
$nombre="ayuda";

return $this->renderHTML('ayuda.twig' , ["valor"=>$nombre]);
}
}

?>
4 changes: 2 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
);

$mapa = $contenedorDeRutas->getMap();
//--Login-----------------------------------------------------------------------------------------------------------------

$mapa->get('home', '/sistematec/home', ['controller' => 'App\controllers\HomeController', 'action' => 'getHome']);
$mapa->get('home', '/mvc/', ['controller'=>'App\controllers\HomeController', 'action'=> 'getHome']);
$mapa->get('ayuda','/mvc/ayuda',['controller'=>'App\controllers\HomeController','action'=> 'getAyuda'] );

//------Mach whit route-------------
$matcher = $contenedorDeRutas->getMatcher();
Expand Down
10 changes: 10 additions & 0 deletions views/ayuda.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends 'padre.twig' %}

{% block contenido %}
<h3>
{{valor}}
</h3>
<h3>
Estamos aprendiendo en san jaun tec
</h3>
{% endblock %}
115 changes: 0 additions & 115 deletions views/base.twig

This file was deleted.

12 changes: 12 additions & 0 deletions views/ejemplo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

</body>
</html>
13 changes: 6 additions & 7 deletions views/home.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<h1>
{{saludo}}
</h1>

<h3>
Dia {{fecha[0]}} Mes {{fecha[1]}} Año {{fecha[2]}}
</h3>
{% extends "padre.twig" %}
{% block seccion %}
{% for alumno in listadoAlumnos %}
<br> {{alumno}}<br>
{% endfor %}
{%endblock%}
17 changes: 17 additions & 0 deletions views/padre.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<header>San Juan Tec</header>
<h1>
esto pertenece a la vista padre
</h1>

{%block contenido %}
{%endblock%}

<footer>Grupo php vista padre </footer>
</body>
</html>