index.php


Versión 0.2

<!DOCTYPE html>
<head>
<title>CLCPHP - Calandario Lit&uacute;rgio Cat&oacute;lico En PHP</title>
</head>
<body>
<!--Versi&oacute;n 0.2 - Agrega, al pie de la p&aacute;gina, un mensil que muestra el mes al que corresponde el d&iacute;a seleccionado. El c&oacute;digo html generado es v&aacute;lido, seg&uacute;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."'>&lt;&lt; D&iacute;a anterior</a> | ";
echo "<a href='index.php?fechaactual=".$manana."'>D&iacute;a posterior &gt;&gt;</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&uacute;rgio Cat&oacute;lico En PHP</title>
</head>
<body>
<!--En esta versi&oacute;n, el programa muestra el d&iacute;a actual y permite cambiarse de d&iacute;a, de a uno, hacia adelante y hacia atr&aacute;s. Adem&aacute;s, el c&oacute;digo html generado es v&aacute;lido, seg&uacute;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."'>&lt;&lt; D&iacute;a anterior</a> | ";
echo "<a href='index.php?fechaactual=".$manana."'>D&iacute;a posterior &gt;&gt;</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.