Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/01/2010, 05:32
sepipe
 
Fecha de Ingreso: enero-2010
Mensajes: 14
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: Calendario php, ayuda porfavor

No aver, tengo todo esto.
Pero no consigo sacar los demas meses ni por ejemplo el mes de febrero tenga 28 dias, todos tienen 31, pero si me empiezan donde los otros terminan.

<?php
//constantes
$dia_co=4;
$mes_co=10;
$anyo_co=2009;
$meses_co=6;
$columna_co=4;
$ultimodia=0;
$month=0;
$year=0;

//Calculate the viewed month
$hoy = mktime (0, 0, 0, $mes_co, 1, $anyo_co);
$nombremes = date("F", $hoy);
$diasmes=date("t",$mes_co);
?>



<table style="width: 105px; border-collapse: collapse;" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr>
<td colspan="7" class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;"><?php echo $nombremes . " " . $anyo_co; ?></span>
</td>
</tr>
<tr>
<td class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;">Lunes</span>
</td>
<td class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;">Martes</span>
</td>
<td class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;">Miercoles</span>
</td>
<td class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;">Jueves</span>
</td>
<td class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;">Viernes</span>
</td>
<td class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;">Sabado</span>
</td>
<td class="calendartodayoff" onmouseover="this.className='calendartodayover'" onmouseout="this.className='calendartodayoff'">
<span style="font-weight: bold;">Domingo</span>
</td>
</tr>
<?php
$mes_co = date("w", $hoy);
$mes_co--;
$ultimodia = date("d", mktime (0, 0, 0, $month+1, 0, $month));
$startdate = -$mes_co;

//Figure out how many rows we need.
$numrows = ceil (((date("t",mktime (0, 0, 0, $month + 1, 0, $year)) + $month) / 7));

//Let's make an appropriate number of rows...
for ($k = 1; $k <= $numrows; $k++){
?><tr><?php
//Use 7 columns (for 7 days)...
for ($i = 0; $i < 7; $i++){
$startdate++;
if (($startdate <= 0) || ($startdate > $ultimodia)){
//If we have a blank day in the calendar.
?><td style="background: #FFFFFF;">&nbsp;</td><?php
} else {

if ($startdate == date("t") && $month == date("n") && $year == date("Y")){
?><td onclick="createform(event)" class="calendartodayoff" onmouseover="this.className='calendartodayover'; checkfortasks ('<?php echo $year . "-" . $month . "-" . $startdate; ?>',event);" onmouseout="this.className='calendartodayoff'; hidetask();"><?php echo date ("j"); ?></td><?php
} else {
?><td onclick="createform(event)" class="calendaroff" onmouseover="this.className='calendarover'; checkfortasks ('<?php echo $year . "-" . $month . "-" . $startdate; ?>',event);" onmouseout="this.className='calendaroff'; hidetask();"><?php echo $startdate; ?></td><?php
}
}
}
?></tr><?php
}
?>

</table>