Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/06/2008, 14:48
sando
 
Fecha de Ingreso: marzo-2006
Mensajes: 110
Antigüedad: 18 años, 2 meses
Puntos: 0
Ayuda en calendario

Hola listeros ya tengo un calendario en PHP, les muestro el codigo

<?php function DayInMonth($month, $year) {
$daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if ($month != 2) return $daysInMonth[$month - 1];
return (checkdate($month, 29, $year)) ? 29 : 28;
}
$month = date("n");
$mes=array(1 => "Enero",
2 => "Febrero",
3 => "Marzo",
4 => "Abril",
5 => "Mayo",
6 => "Junio",
7 => "Julio",
8 => "Agosto",
9 => "Septiembre",
10 => "Octubre",
11 => "Noviembre",
12 => "Diciembre"
);
$year = date("Y");
$day = date("j");
$fecha_mes=$year."/".$day."/".$month;

//echo DayInMonth($month,$year);
$date = DayInMonth($month,$year);
$mesa=$month-1;
$anoa=$year;
if ($mesa==0)
{
$anoa--;
$mesa=12;
}
$mess = $month + 1;
$anos = $year;
if ($mess==13){
$anos++;
$mess=1;
}
echo'<table width="4%" border="1" cellspacing="0" cellpadding="0">';

echo '<tr bgcolor="#0099FF"><td><a href="reservar.php?">Año Anterior</a></td><td><a href="#">Mes Antrerior</a></td>
<td colspan="2" align="center" style="color:#ffffff">'.$meses=$mes[$month].'</td>
<td align="center" style="color:#ffffff">'.$year.'</td>
<td><a href="#">Mes Siguiente</a></td><td><a href="#">Año Siguiente</a></td></tr>';
echo '<tr bgcolor="#0099FF">
<td> <div align="center"><font color="#FFFFFF"><strong>Lunes</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Martes</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Miercoles</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Jueves</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Viernes</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Sabado</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Domingo</strong></font></div></td>
</tr>';

///creamos el objeto
//$pinta1= new pinta($dia,$diaf);

for($j = 1; $j < $date + 1; $j++) {

?>
<td bgcolor=<?php ?> <?php if(pinta($j,$dia,$diaf)==1){ ?> "yellow" <?php
}
if(pinta2($j,$diar,$diarf)==1){ ?> "red" <?php
}else{ ?> "green" <?php } ?> >
<?php
echo $j;
?>
</td>
<?php


if($j % 7 == 0)
echo "</tr><tr>";


}

echo '</tr>';
echo '</table>';

Las funsiones son para poder pintar los eventos.

La pregunta es de que como le hago para poder regresar al mes anterior o darle al mes posterior, asi como los años. Gracias por ayudar