Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. Problemi nella creazione di un calendario con php

Problemi nella creazione di un calendario con php

Pianificato Fissato Bloccato Spostato Coding
4 Post 2 Autori 854 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • J
    J
    jeeves
    scritto su ultima modifica di
    User Attivo 0
    #1
    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&igrave;"; break;
    case 2: $this->gsett = "Marted&igrave;"; break;
    case 3: $this->gsett = "Mercoled&igrave;"; break;
    case 4: $this->gsett = "Gioved&igrave;"; break;
    case 5: $this->gsett = "Venerd&igrave;"; 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,

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • J
      J
      jeeves
      scritto su ultima modifica di
      User Attivo 0
      #2

      Meh? Nessuno? Perché non mi aiutate? Su avanti...

      Grazie

      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • M
        M
        momino
        scritto su ultima modifica di
        User Attivo 0
        #3

        potresti provare a cambiare questo

        if($this->mkg($this->j+1) == 0)
        

        in questo

        if($this->mkg(($this->j)+1) == 0)
        

        probabilmente le parentesi non rendono l'effetto voluto...

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0
        • J
          J
          jeeves
          scritto su ultima modifica di
          User Attivo 0
          #4

          Non succede niente di nuovo, è sempre come prima... come risolvo?

          1 Risposta Ultima Risposta
          Miglior risposta 0
          0

          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
          Rispondi
          • Risposta alla discussione
          Effettua l'accesso per rispondere
          • Da Vecchi a Nuovi
          • Da Nuovi a Vecchi
          • Più Voti


          • Accedi

          • Non hai un account? Registrati

          • Accedi o registrati per effettuare la ricerca.
          • Primo post
            Ultimo post
          Home Accedi Registrati
          Menu
          • CATEGORIES
          • La Community Connect.gt
          • Presentati alla Community
          • News Ufficiali da Connect.gt
          • Internet News
          • A Scuola Di
          • Digital Marketing
          • Intelligenza Artificiale
          • SEO & GEO
          • Web Marketing e Content
          • Google Analytics e Web Analytics
          • Google Ads & Advertising
          • YouTube
          • TikTok, Instagram e altri Social
          • Google Adsense, Affiliazioni e Guadagno
          • E-Commerce
          • Coding e Sistemistica
          • Help Center: consigli per il tuo progetto
          • Hosting e Cloud
          • Coding
          • CMS & Piattaforme Self-Hosted
          • Annunci e Collaborazioni
          • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
          • Collaborazioni WEB e Lavoro: offro e cerco
          • Impresa, Fisco e Leggi
          • Consulenza Legale e Professioni Web
          • Consulenza Fiscale, Imprese, Startup e P.Iva
          • Gli Off Topic
          • PC, Smartphone e altri Hardware
          • Tutti i Software
          • GT Fetish Cafè
          • Discussioni
          • Non letti 0
          • Recenti
          • Hashtag
          • Popolare
          • Utenti
          • Privacy
          • Termini e condizioni
          • © 2026 Search On Media Group S.r.l.