Visualizzazione dei risultati da 1 a 3 su 3

Discussione: date e calendari

  1. #1
    Utente di HTML.it L'avatar di polinet
    Registrato dal
    Nov 2000
    Messaggi
    993

    date e calendari

    Ciao, sto realizzando un calendario per inserire degli eventi in ogni specifico giorno.
    Il mio problema è che da questo codice, il giorno comincia con il giorno successivo alla data del sistema.
    Io vorrei che mi stampasse tutto il mese senza tener conto della data di quel momento.
    Questo è lo script, sò che non è corretto, ma visualizza i 30 giorni dalla data odierna.
    Dove trovo uno script o tutorial che potrebbe andarmi bene?
    GRAZIE

    script:

    <?

    echo "Gennaio 2006:";
    echo "
    ";

    $oggi = getdate();
    echo "{$oggi['weekday']}, {$oggi['mday']} {$oggi['month']}";
    echo "
    ";

    for ($i=1; $i<30; $i++)
    {
    echo date ("D - d",mktime(0,0,0,date("m"),date("d")+$i,date("Y"))) ;
    }
    ?>

    ¿Hasta la pasta?

  2. #2
    Utente di HTML.it L'avatar di dany0
    Registrato dal
    Feb 2003
    Messaggi
    422
    questo potrebbe andarti bene?

    <?php

    define ('ADAY', (60*60*24));
    $datearray = getdate();
    $annoattuale=$datearray['year'];
    $mesecontrollo=$datearray['mon'];
    $mese=(int)$_POST[mesecal];
    $anno=(int)$_POST[annocal];
    $vnews=$_GET[vnews];


    if($mese>0){$month=$mese;$datearray['mon']=$month;}
    if($vnews==1){$month = $_GET[vmese];$datearray['mon']=$month;}
    else{$month=$datearray['mon'];}

    if($anno>0){$year=$anno;$datearray['year']=$anno;}
    else{$year=$datearray['year'];}


    $start= mktime(0,0,0,$month,1,$year);
    $firstdayarray = getdate($start);

    $mon = Array('','Gen','Feb','Mar','Apr','Mag','Giu','Lug' ,'Ago','Set','Ott','Nov','Dic');
    $days = Array('Do','Lu','Ma','Me','Gi','Ve','Sa');

    echo"<center>
    <form method='POST' action='index.php' name='calend'>
    <table border=0 class='calendario'>
    <tr>
    <td colspan='7'>
    <center>";


    $inizio=$month-11;

    echo"
    <select size='1' class='inform' name='mesecal' onchange='document.calend.submit()'>
    <option value=1";if($month==1){echo" selected";}echo">$mon[1]</option>
    <option value=2";if($month==2){echo" selected";}echo">$mon[2]</option>
    <option value=3";if($month==3){echo" selected";}echo">$mon[3]</option>
    <option value=4";if($month==4){echo" selected";}echo">$mon[4]</option>
    <option value=5";if($month==5){echo" selected";}echo">$mon[5]</option>
    <option value=6";if($month==6){echo" selected";}echo">$mon[6]</option>
    <option value=7";if($month==7){echo" selected";}echo">$mon[7]</option>
    <option value=8";if($month==8){echo" selected";}echo">$mon[8]</option>
    <option value=9";if($month==9){echo" selected";}echo">$mon[9]</option>
    <option value=10";if($month==10){echo" selected";}echo">$mon[10]</option>
    <option value=11";if($month==11){echo" selected";}echo">$mon[11]</option>
    <option value=12";if($month==12){echo" selected";}echo">$mon[12]</option>
    </select>

    <select size='1' class='inform' name='annocal' onchange='document.calend.submit()'>
    <option value=$annoattuale>$annoattuale</option>
    ";$yea=$annoattuale-1;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
    ";$yea=$annoattuale-2;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
    ";$yea=$annoattuale-3;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
    ";$yea=$annoattuale-4;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
    </select>
    </td>
    </tr>
    <tr>";



    foreach($days as $day)
    {echo"
    <td>$day</div></td>";
    }

    for( $count=0;$count<(6*7);$count++)
    {
    $dayarray = getdate($start);
    if((($count) % 7) == 0)
    {
    if($dayarray['mon'] != $datearray['mon'])
    break;
    echo "</tr><tr>";
    }
    if($count < $firstdayarray['wday'] || $dayarray['mon'] != $month)
    {
    echo "<td>
    </td>";
    }
    else
    {
    if($dayarray['mday'] == $datearray['mday'])
    {if($month==$mesecontrollo){
    echo"<td>";}
    else{echo"<td>";}

    $month1=$month;
    if($month1<10){$month1="0".$month;}
    $richiamodata=$dayarray[mday]."".$month1."".$year;


    $query="select * from tabella_news where richiamodata=$richiamodata";
    $ris=mysql_query($query,$conn) or die ("errore query4");
    $riga=mysql_fetch_array($ris);


    if($riga[richiamodata]>0){
    echo"
    <a href=index.php?cella=news/richiamonews.php&data=$richiamodata&vnews=1&vmese= $month>$dayarray[mday]</a>";}

    else{echo"$dayarray[mday]";}

    ?>

    </td>
    <?php
    $start += ADAY;
    }
    else
    {
    echo"<td>";

    $month1=$month;
    if($month1<10){$month1="0".$month;}
    $richiamodata=$dayarray[mday]."".$month1."".$year;


    $query="select * from tabella_news where richiamodata=$richiamodata";
    $ris=mysql_query($query,$conn) or die ("errore query5");
    $riga=mysql_fetch_array($ris);


    if($riga[richiamodata]>0){echo"<a href=index.php?cella=news/richiamonews.php&data=$richiamodata&vnews=1&vmese= $month>$dayarray[mday]</a>";}
    else{echo"$dayarray[mday]";}


    ?>

    </td>
    <?php
    $start += ADAY;
    }
    }
    }
    ?>

    </tr>
    </table>
    </form>





    visibile su www.comonight.com

  3. #3
    Utente di HTML.it L'avatar di polinet
    Registrato dal
    Nov 2000
    Messaggi
    993

    UAO!!!!

    Ora lo provo!

    io ho fatto cosi e funziona pefettamente... almeno fino ad adesso...;-)

    <?
    function counter()
    {
    static $count = 1;
    return $count++;
    }
    echo("<table border=0><tr>");
    echo("<td><font face=verdana size=1>Prenota</font></td>");
    for($p = 1; $p <=1; $p++)
    {
    for($i = 0; $i <=30; $i++)
    {
    $day = counter();
    $giorno = 1;
    $mese = 1;
    $anno = 2006;

    echo("<td bgcolor=#c0c0c0 align=center>");
    echo("<font face=verdana size=1>");
    echo date ("D",mktime(0,0,0,date($mese),date($giorno)+$i,dat e($anno)));
    echo "
    ";
    echo ("<a href=prenota.php?giorno=$day&mese=$mese>");
    $totale = date ("d",mktime(0,0,0,date($mese),date($giorno)+$i,dat e($anno)));
    echo("$totale</a></font></td>");
    }
    }
    echo("</tr>");
    echo("</table>");
    ?>
    ¿Hasta la pasta?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.