allora.. stavo tentando di fare un calendario stupido (niente interfacciamento a db, xml o altro)
quando scrivo questa bella paginetta che sembra funzionare davvero bene...
il problema me lo da con marzo 2004...codice:<?php $giorno = 60 * 60 * 24; $month = array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"); $day_on = mktime(0, 0, 0, date("n"), 1, date("Y")); $day_off = mktime(0, 0, 0, date("n")+1, 0, date("Y")); $week_day_on = date("w", $day_on); $week_day_off = date("w", $day_off); if ( $week_day_on == 0 ) { $week_day_on = 6; } if ( $week_day_off == 0 ) { $week_day_off = 6; } $ciclo = 1; ?> <table width="280" cellpadding="5" cellspacing="0" border="0"> <tr> <td width="100%" align="center" valign="middle" colspan="7"><?php echo $month[ date("n") - 1 ] . "." . date("Y"); ?></td> </tr> <tr> <td width="40" align="center" valign="middle">Lu</td> <td width="40" align="center" valign="middle">Ma</td> <td width="40" align="center" valign="middle">Me</td> <td width="40" align="center" valign="middle">Gi</td> <td width="40" align="center" valign="middle">Ve</td> <td width="40" align="center" valign="middle">Sa</td> <td width="40" align="center" valign="middle">Do</td> </tr> <?php $il_giorno = ($day_on - $week_day_on * $giorno + $ciclo * $giorno); ?> <tr> <?php do { ?> <td width="40" align="center" valign="middle" class="<?php echo $color; ?>"><?php echo date("d", $il_giorno); ?></td> <?php if ( date("w", $il_giorno) == 0 ) { $ciclo += $giorno; ?> </tr> <?php if ( $il_giorno < ($day_off + 7 * $giorno - $week_day_off * $giorno) ) { ?> <tr> <?php } } ?> <?php $il_giorno += $giorno; } while ( $il_giorno <= ( $day_off + 7 * $giorno - $week_day_off * $giorno) ); ?> </tr> </table>
come è possibile?
help...

Rispondi quotando

