Added simple templates module

This commit is contained in:
Antonio de la Rosa 2025-11-23 01:26:30 +01:00
parent 47c7003e3b
commit 17b6df73ff
7 changed files with 265 additions and 38 deletions

View file

@ -41,30 +41,12 @@ class AppController extends TplController{
header('Location: '.Url::make_url('admin', 'app', ['signup']));
}
//print_r($this->db->table);
/*$conn=MySQL::get_pdo_connection();
$sth=$conn->query('SELECT count(*) as num_items from useradmin');
$count=$sth->fetch()[0];
if($count==0) {
header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['signup']));
}
echo View::load_view(['login' => 1], 'login');*/
break;
case 'signup':
echo $this->tpl->load_template('signup', ['title' => 'Signup']);
break;

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?=$title?></title>
<style>
body {
margin:0px;
background-color: #060502;
font-family: sans-serif;
color: #fbfbfb;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
#container {
/*margin-right:auto;
margin-left:auto;*/
min-width: 400px;
background-color: #000;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
margin-top: 40px;
border-radius: 0.75rem;
border-top: 4px solid #4f46e5;
text-align:center;
padding: 15px 5px;
}
.icon {
margin: 0 auto 0 auto;
height: 4rem;
width: 4rem;
color: #fbfbfb; /* Índigo 600 */
}
input {
width: 300px;
border: solid #454545 2px;
border-radius: 6px;
font-size: 28px;
}
.button {
background-color: #007bff;
color: white;
padding: 10px;
border: none;
border-radius: 6px;
font-size: 18px;
transition: background-color 0.3s ease;
border: solid #454545 2px;
border-radius: 6px;
}
.button:hover {
background-color: #0056b3; /* Un azul más oscuro */
}
</style>
</head>
<body>
<div id="container">
<h1>Login</h1>
<p align="center">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" stroke="currentColor" stroke-width="2" style="fill: currentColor;"><!--!Font Awesome Free v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M470.5 463.6C451.4 416.9 405.5 384 352 384L288 384C234.5 384 188.6 416.9 169.5 463.6C133.9 426.3 112 375.7 112 320C112 205.1 205.1 112 320 112C434.9 112 528 205.1 528 320C528 375.7 506.1 426.2 470.5 463.6zM430.4 496.3C398.4 516.4 360.6 528 320 528C279.4 528 241.6 516.4 209.5 496.3C216.8 459.6 249.2 432 288 432L352 432C390.8 432 423.2 459.6 430.5 496.3zM320 576C461.4 576 576 461.4 576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 461.4 178.6 576 320 576zM320 304C297.9 304 280 286.1 280 264C280 241.9 297.9 224 320 224C342.1 224 360 241.9 360 264C360 286.1 342.1 304 320 304zM232 264C232 312.6 271.4 352 320 352C368.6 352 408 312.6 408 264C408 215.4 368.6 176 320 176C271.4 176 232 215.4 232 264z"/></svg>
</p>
<?=$this->section('content')?>
</div>
</body>
</html>

View file

@ -0,0 +1,14 @@
<?=$this->layout('login_tpl', ['title' => 'Signup'])?>
<?=$this->start('content')?>
<p><label for="username"></label><input type="text" name="username" id="username_form" placeholder="<?=_('Username')?>"/></p>
<p class="error" id="username_error"></p>
<p><input type="text" name="password" id="password_form" placeholder="<?=_('Password')?>"/></p>
<p class="error" id="password_error"></p>
<p><input type="text" name="repeat_password" id="repeat_password_form" placeholder="<?=_('Repeat Password')?>"/></p>
<p class="error" id="repeat_password_error"></p>
<p><input type="text" name="email" id="email_form" placeholder="<?=_('Email')?>"/></p>
<p class="error" id="email_error"></p>
<p>
<input type="submit" class="button" value="<?=_('Create user')?>" />
</p>
<?=$this->end('content')?>