Problemi nella creazione di un calendario con php
-
Salve,
ho intenzione di creare con php un calendario nel formato come quello di mkportal.
Ho scritto sufficiente codice php ma non visualizza niente:
<?php class cal { function __construct() { } function mkg($d) { return(date('w', mktime(0, 0, 0, $this->dati['mese'], $d, $this->dati['anno']))); } function calendario() { $this->dati = array(giorno => date('j'), bis => date('L'), mese => date('n'), gmese => date('t'), gsett => date('w'), setta => date('W'), anno => date('Y'), settm => round(date('t')/7)+1, gsett1 => date('w', mktime(0, 0, 0, date('n'), 1, date('Y')))); $this->j = 0; switch($this->dati['mese']) { case 1: $this->mese = "Gennaio"; break; case 2: $this->mese = "Febbraio"; break; case 3: $this->mese = "Marzo"; break; case 4: $this->mese = "Aprile"; break; case 5: $this->mese = "Maggio"; break; case 6: $this->mese = "Giugno"; break; case 7: $this->mese = "Luglio"; break; case 8: $this->mese = "Agosto"; break; case 9: $this->mese = "Settembre"; break; case 10: $this->mese = "Ottobre"; break; case 11: $this->mese = "Novembre"; break; case 12: $this->mese = "Dicembre"; break; default: $this->mese = ""; break; } switch($this->dati['gsett']) { case 0: $this->gsett = "Domenica"; break; case 1: $this->gsett = "Lunedì"; break; case 2: $this->gsett = "Martedì"; break; case 3: $this->gsett = "Mercoledì"; break; case 4: $this->gsett = "Giovedì"; break; case 5: $this->gsett = "Venerdì"; break; case 6: $this->gsett = "Sabato"; break; default: $this->gsett = ""; break; } echo '<table border="0" width="30%" height="30%"> <tr> <td width="100%" height="15%">'.$this->mese.' '.$this->dati['anno'].'</td> </tr>'; for($this->i=0; $this->i<$this->dati['settm']; $this->i++) { $this->k = 0; echo '<tr> <td width="14%" height="15%">'; if($this->j == 0) { if($this->mkg($this->j+1) == 0) { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } } else { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } if($this->j == 0) { if($this->mkg($this->j+1) == 0) { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } } else { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } if($this->j == 0) { if($this->mkg($this->j+1) == 0) { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } } else { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } if($this->j == 0) { if($this->mkg($this->j+1) == 0) { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } } else { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } if($this->j == 0) { if($this->mkg($this->j+1) == 0) { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } } else { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } if($this->j == 0) { if($this->mkg($this->j+1) == 0) { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } } else { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } if($this->j == 0) { if($this->mkg($this->j+1) == 0) { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } } else { echo(++$this->j == $this->dati['giorno'] ? '('.$this->j.')' : $this->j); } echo '</td> </tr>'; } echo '</table>'; } } $cal = new cal(); $cal->calendario(); ?>Ho voluto mettere anche il giorno di oggi tra parentesi per evidenziarlo, ma poi sistemerò io...
Il problema è che non dà nessun errore ma come codice html restituisce questo:
<table border="0" width="30%" height="30%"> <tr> <td width="100%" height="15%">Ottobre 2008</td> </tr><tr> <td width="14%" height="15%"></td> </tr><tr> <td width="14%" height="15%"></td> </tr><tr> <td width="14%" height="15%"></td> </tr><tr> <td width="14%" height="15%"></td> </tr><tr> <td width="14%" height="15%"></td> </tr></table>Mi sapete gentilmente correggereil codice php per fare venire un calendario decente?
Grazie,

-
-
-
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi