Versión 0.2
<!DOCTYPE html>
<head>
<title>CLCPHP - Calandario Litúrgio Católico En PHP</title>
</head>
<body>
<!--Versión 0.2 - Agrega, al pie de la página, un mensil que muestra el mes al que corresponde el día seleccionado. El código html generado es válido, según http://html5.validator.nu -->
<?php
include("funciones.php");
if(!isset($_GET['fechaactual'])) {
$_GET['fechaactual']=time();}
$ayer=mktime(0,0,0,date("m",$_GET['fechaactual']), date("d",$_GET['fechaactual'])-1,date("Y",$_GET['fechaactual']));
$manana=mktime(0,0,0,date("m",$_GET['fechaactual']), date("d",$_GET['fechaactual'])+1,date("Y",$_GET['fechaactual']));
echo "<h3>".traducir(date('l j \d\e F \d\e Y',$_GET['fechaactual']))."</h3>\n";
echo "<a href='index.php?fechaactual=".$ayer."'><< Día anterior</a> | ";
echo "<a href='index.php?fechaactual=".$manana."'>Día posterior >></a>";
echo "\n<table>\n";
echo "<tr><th colspan='7'>".ucfirst(traducir(date('F \d\e Y',$_GET['fechaactual'])))."</th></tr>\n";
echo "<tr><th>Do</th><th>Lu</th><th>Ma</th><th>Mi</th><th>Ju</th><th>Vi</th><th>Sa</th></tr>\n";
echo "<tr>";
$primerDiaMes=mktime(0,0,0,date("m",$_GET['fechaactual']), '1',date("Y",$_GET['fechaactual']));
for ($i=1;$i<=date('w',$primerDiaMes);$i++)
{ echo "<td></td>"; }
$restoPrimeraSemana=8-$i;
for ($a=1;$a<=$restoPrimeraSemana;$a++)
{echo "<td>".$a."</td>";}
echo "</tr>\n<tr>";
$diasDelMes=date('t',$primerDiaMes);
$i=($i*-1) + 9;
$y=1;
for ($i;$i<=$diasDelMes;$i++)
{ echo "<td>".$i."</td>";
if (($y%7=="0") && ($i==$diasDelMes)) { }
elseif (($y%7=="0") && ($i<$diasDelMes)) { echo "</tr>\n<tr>"; }
$y++;
}
$y--;
$i--;
if (($y%7!="0") && ($i==$diasDelMes)) {
$ultimoDiaMes=mktime(0,0,0,date("m",$_GET['fechaactual']), $diasDelMes,date("Y",$_GET['fechaactual']));
$restoUltimaSemana= (date('w',$ultimoDiaMes) * -1) + 6;
for ($i=1;$i<=$restoUltimaSemana;$i++)
{ echo "<td></td>"; }
}
echo "</tr>\n";
echo "</table>\n";
?>
</body>
</html>
Versión 0.1
<!DOCTYPE html>
<head>
<title>CLCPHP - Calandario Litúrgio Católico En PHP</title>
</head>
<body>
<!--En esta versión, el programa muestra el día actual y permite cambiarse de día, de a uno, hacia adelante y hacia atrás. Además, el código html generado es válido, según http://html5.validator.nu -->
<?php
include("funciones.php");
if(!isset($_GET['fechaactual'])) {
$_GET['fechaactual']=time();}
$ayer=mktime(0,0,0,date("m",$_GET['fechaactual']), date("d",$_GET['fechaactual'])-1,date("Y",$_GET['fechaactual']));
$manana=mktime(0,0,0,date("m",$_GET['fechaactual']), date("d",$_GET['fechaactual'])+1,date("Y",$_GET['fechaactual']));
echo "<div style='text-align:center;'>";
echo "<h3>".traducir(date('l d \d\e F \d\e Y',$_GET['fechaactual']))."</h3>";
echo "<a href='index.php?fechaactual=".$ayer."'><< Día anterior</a> | ";
echo "<a href='index.php?fechaactual=".$manana."'>Día posterior >></a>";
echo "</div>";
?>
</body>
</html>
No hay comentarios:
Publicar un comentario
Gracias por el comentario.
Luego de ser sometido a moderación y si amerita, será publicado.