Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15

Discussione: Data in array

  1. #1

    Data in array

    Ciao a tutti

    ho questo codice php

    codice:
    $now   = new DateTime;   $clone = clone $now;     
      $clone->modify( '1 day' ); 
    $testoround = array("00" => array(4=>"Oggi ore 7>10", 5=>"Oggi ore 10>13", ecc...
    A me servirebbe che al posto della scritta Oggi ci fosse $now ... ho provato in molti modi, ma ho sempre errori diversi

    Qualcuno sa aiutarmi?? Grazie in anticipo

  2. #2
    proprio nessuno??

  3. #3
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Forse perche non si capisce cosa vuoi di preciso. Io per esempio non ho capito nulla. $now è un'istanza di un oggetto. Quindi dire che vuoi rimpiazzare Oggi da $now non ha senso. Dare un esempio avrebbe aiutato.

    Comunque mi butto.

    Codice PHP:
    <?php
    date_default_timezone_set
    ('UTC');
    $now   = new DateTime();        
    $clone = clone $now;
    $clone->modify'1 day' ); 
    $testoround = array("00" => array(4=>"Oggi ore 7>10"5=>"Oggi ore 10>13"));
    $a $clone->format('d-m-y');
    foreach(
    $testoround as $gkey => $subarray) {
      foreach(
    $subarray as $key => $value) {
         
    $pippo str_replace("Oggi",$a,$value);
         
    $testoround[$gkey][$key] = $pippo;
      }
    }
    var_dump($testoround);
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  4. #4
    Quote Originariamente inviata da badaze Visualizza il messaggio
    Forse perche non si capisce cosa vuoi di preciso. Io per esempio non ho capito nulla. $now è un'istanza di un oggetto. Quindi dire che vuoi rimpiazzare Oggi da $now non ha senso. Dare un esempio avrebbe aiutato.

    Comunque mi butto.

    Codice PHP:
    <?php
    date_default_timezone_set
    ('UTC');
    $now   = new DateTime();        
    $clone = clone $now;
    $clone->modify'1 day' ); 
    $testoround = array("00" => array(4=>"Oggi ore 7>10"5=>"Oggi ore 10>13"));
    $a $clone->format('d-m-y');
    foreach(
    $testoround as $gkey => $subarray) {
      foreach(
    $subarray as $key => $value) {
         
    $pippo str_replace("Oggi",$a,$value);
         
    $testoround[$gkey][$key] = $pippo;
      }
    }
    var_dump($testoround);
    Hai ragione, scusami
    Il codice php non l'ho fatto io, ma me lo hanno fatto... Inserisco per intero la parte interessata dall'eventuale modifica
    codice:
    if(isset($_POST['tau']))    $tau=$_POST['tau'];
    else
        $tau=4;  
    $arraytou=array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
    $arraytouplus=array(4=>9, 5=>12, 6=>15, 7=>18, 8=>21, 9=>24, 10=>27, 11=>30, 12=>33, 13=>36, 14=>39, 15=>42, 16=>45, 17=>48, 18=>51, 19=>54, 20=>57, 21=>60, 22=>63, 23=>66, 24=>69, 25=>72);
    
    
    $posizionitop=array(0,50,165,290,390,465,25,130,250,355,60,175,250,325,420,35,135,215,345,430,35,100,190,275,115,250,75,175,235);
    $posizionileft=array(0,45,55,65,85,150,175,170,185,190,280,250,305,275,255,375,325,385,355,365,490,420,475,440,520,530,590,565,615);
    $valround = array("00" => array(8,9,10,11,16,17,18,19,24,25), "06" => array(6,7,8,9,14,15,16,17,22,23,24,25), "12" => array(4,5,6,7,12,13,14,15,20,21,22,23), "18" => array(4,5,10,11,12,13,18,19,20,21));
    
    
    $testoround = array("00" => array(4=>"Oggi ore 7>10", 5=>"Oggi ore 10>13", 6=>"Oggi ore 13>16", 7=>"Oggi ore 16>19", 8=>"Oggi ore 19>22", 9=>"Oggi/<br>Domani ore 22>1", 10=>"Domani ore 1>4", 11=>"Domani ore 4>7", 12=>"Domani ore 7>10", 13=>"Domani ore 10>13", 14=>"Domani ore 13>16", 15=>"Domani ore 16>19", 16=>"Domani ore 19>22", 17=>"Domani/<br>Dopodomani ore 22>1", 18=>"Dopodomani ore 1>4", 19=>"Dopodomani ore 4>7", 20=>"Dopodomani ore 7>10", 21=>"Dopodomani ore 10>13", 22=>"Dopodomani ore 13>16", 23=>"Dopodomani ore 16>19", 24=>"Dopodomani ore 19>22", 25=>"Dopodomani/<br>Terzo giorno ore 22>1"),"06" => array(4=>"Oggi ore 13>16", 5=>"Oggi ore 16>19", 6=>"Oggi ore 19>22", 7=>"Oggi/<br>Domani ore 22>1", 8=>"Domani ore 1>4", 9=>"Domani ore 4>7", 10=>"Domani ore 7>10", 11=>"Domani ore 10>13", 12=>"Domani ore 13>16", 13=>"Domani ore 16>19", 14=>"Domani ore 19>22", 15=>"Domani/<br>Dopodomani ore 22>1", 16=>"Dopodomani ore 1>4", 17=>"Dopodomani ore 4>7", 18=>"Dopodomani ore 7>10", 19=>"Dopodomani ore 10>13", 20=>"Dopodomani ore 13>16", 21=>"Dopodomani ore 16>19", 22=>"Dopodomani ore 19>22", 23=>"Dopodomani/<br>Terzo giorno ore 22>1", 24=>"Terzo giorno ore 1>4", 25=>"Terzo giorno ore 4>7"),"12" => array(4=>"Oggi ore 19>22", 5=>"Oggi/Domani ore 22>1", 6=>"Domani ore 1>4", 7=>"Domani ore 4>7", 8=>"Domani ore 7>10", 9=>"Domani ore 10>13", 10=>"Domani ore 13>16", 11=>"Domani ore 16>19", 12=>"Domani ore 19>22", 13=>"Domani/<br>Dopodomani ore 22>1", 14=>"Dopodomani ore 1>4", 15=>"Dopodomani ore 4>7", 16=>"Dopodomani ore 7>10", 17=>"Dopodomani ore 10>13", 18=>"Dopodomani ore 13>16", 19=>"Dopodomani ore 16>19", 20=>"Dopodomani ore 19>22", 21=>"Dopodomani/<br>Terzo Giorno ore 22>1", 22=>"Terzo Giorno ore 1>4", 23=>"Terzo Giorno ore 4>7", 24=>"Terzo Giorno ore 7>10", 25=>"Terzo Giorno ore 10>13"),"18" => array(4=>"Oggi ore 1>4", 5=>"Oggi ore 4>7", 6=>"Oggi ore 7>10", 7=>"Oggi ore 10>13", 8=>"Oggi ore 13>16", 9=>"Oggi ore 16>19", 10=>"Oggi ore 19>22", 11=>"Oggi/<br>Domani ore 22>1", 12=>"Domani ore 1>4", 13=>"Domani ore 4>7", 14=>"Domani ore 7>10", 15=>"Domani ore 10>13", 16=>"Domani ore 13>16", 17=>"Domani ore 16>19", 18=>"Domani ore 19>22", 19=>"Domani/<br>Dopodomani ore 22>1", 20=>"Dopodomani ore 1>4", 21=>"Dopodomani ore 4>7", 22=>"Dopodomani ore 7>10", 23=>"Dopodomani ore 10>13", 24=>"Dopodomani ore 13>16", 25=>"Dopodomani ore 16>19")
    );
    In pratica a me serve che OGGI diventi la data di oggi in formato gg mese YY (es. 21 Gennaio 2016 oppure basterebbe anche solo 21 Gennaio) ... DOMANI diventi la data di OGGI+1... DOPODOMANI diventi OGGI+2 e TERZO GIORNO diventi OGGI+3

    Grazie ancora a chi vorrà aiutarmi
    Ultima modifica di zampatafredda; 21-01-2016 a 20:58

  5. #5
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Prova questo.

    Codice PHP:
    <?php 
    $giorni    
    = array();
    $giorni[0] = 'Oggi';
    $giorni[1] = 'Domani';
    $giorni[2] = 'Dopodomani';
    $giorni[3] = 'Terzo Giorno';

    $mese['01'] = 'Gennaio';
    $mese['02'] = 'Febbraio';
    $mese['03'] = 'Marzo';
    $mese['04'] = 'Aprile';
    $mese['05'] = 'Maggio';
    $mese['06'] = 'Giugno';
    $mese['07'] = 'Luglio';
    $mese['08'] = 'Agosto';
    $mese['09'] = 'Settembre';
    $mese['10'] = 'Ottobre';
    $mese['11'] = 'Novembre';
    $mese['12'] = 'Dicembre';

    $testoround = array(
    "00" => array(4=>"Oggi ore 7>10"5=>"Oggi ore 10>13"6=>"Oggi ore 13>16"7=>"Oggi ore 16>19"8=>"Oggi ore 19>22"9=>"Oggi/<br>Domani ore 22>1"10=>"Domani ore 1>4"11=>"Domani ore 4>7"12=>"Domani ore 7>10"13=>"Domani ore 10>13"14=>"Domani ore 13>16"15=>"Domani ore 16>19"16=>"Domani ore 19>22"17=>"Domani/<br>Dopodomani ore 22>1"18=>"Dopodomani ore 1>4"19=>"Dopodomani ore 4>7"20=>"Dopodomani ore 7>10"21=>"Dopodomani ore 10>13"22=>"Dopodomani ore 13>16"23=>"Dopodomani ore 16>19"24=>"Dopodomani ore 19>22"25=>"Dopodomani/<br>Terzo giorno ore 22>1"),
    "06" => array(4=>"Oggi ore 13>16"5=>"Oggi ore 16>19"6=>"Oggi ore 19>22"7=>"Oggi/<br>Domani ore 22>1"8=>"Domani ore 1>4"9=>"Domani ore 4>7"10=>"Domani ore 7>10"11=>"Domani ore 10>13"12=>"Domani ore 13>16"13=>"Domani ore 16>19"14=>"Domani ore 19>22"15=>"Domani/<br>Dopodomani ore 22>1"16=>"Dopodomani ore 1>4"17=>"Dopodomani ore 4>7"18=>"Dopodomani ore 7>10"19=>"Dopodomani ore 10>13"20=>"Dopodomani ore 13>16"21=>"Dopodomani ore 16>19"22=>"Dopodomani ore 19>22"23=>"Dopodomani/<br>Terzo giorno ore 22>1"24=>"Terzo giorno ore 1>4"25=>"Terzo giorno ore 4>7"),
    "12" => array(4=>"Oggi ore 19>22"5=>"Oggi/Domani ore 22>1"6=>"Domani ore 1>4"7=>"Domani ore 4>7"8=>"Domani ore 7>10"9=>"Domani ore 10>13"10=>"Domani ore 13>16"11=>"Domani ore 16>19"12=>"Domani ore 19>22"13=>"Domani/<br>Dopodomani ore 22>1"14=>"Dopodomani ore 1>4"15=>"Dopodomani ore 4>7"16=>"Dopodomani ore 7>10"17=>"Dopodomani ore 10>13"18=>"Dopodomani ore 13>16"19=>"Dopodomani ore 16>19"20=>"Dopodomani ore 19>22"21=>"Dopodomani/<br>Terzo Giorno ore 22>1"22=>"Terzo Giorno ore 1>4"23=>"Terzo Giorno ore 4>7"24=>"Terzo Giorno ore 7>10"25=>"Terzo Giorno ore 10>13"),
    "18" => array(4=>"Oggi ore 1>4"5=>"Oggi ore 4>7"6=>"Oggi ore 7>10"7=>"Oggi ore 10>13"8=>"Oggi ore 13>16"9=>"Oggi ore 16>19"10=>"Oggi ore 19>22"11=>"Oggi/<br>Domani ore 22>1"12=>"Domani ore 1>4"13=>"Domani ore 4>7"1=>"Domani ore 7>10"15=>"Domani ore 10>13"16=>"Domani ore 13>16"17=>"Domani ore 16>19"18=>"Domani ore 19>22"19=>"Domani/<br>Dopodomani ore 22>1"20=>"Dopodomani ore 1>4"21=>"Dopodomani ore 4>7"22=>"Dopodomani ore 7>10"23=>"Dopodomani ore 10>13"24=>"Dopodomani ore 13>16"25=>"Dopodomani ore 16>19")
    );

    date_default_timezone_set('UTC');
    for (
    $i=3;$i>=0;$i--) {
      
    $now      = new DateTime(); 
     
    $now->modify"$i day" ); 
      
      
    $a $now->format('d-m-y');
     
    $m $now->format('m');
     
    $a str_replace("-$m-"," ".$mese[$m]." ",$a);
      foreach(
    $testoround as $gkey => $subarray) {
        foreach(
    $subarray as $key => $value) {
         
    $pippo str_ireplace($giorni[$i],$a,$value);
         
    $testoround[$gkey][$key] = $pippo;
        }
      }
    }
    var_dump($testoround); 
     
    ?>
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  6. #6
    con la tua modifica mi sparisce la cartina di fondo della pagina e mi appaiono le scritte

    infatti ecco come comincia il mio php

    codice:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>
    #mappa{
    	background-image:url(testmeteo2/triv.jpg);
    	width:720px;
    	height:526px;
    	position: relative;
    }
    </style>
    
    
    <?php
    /*
    0 round;
    1 id;
    2 tau;
    3 temp;
    4 prec;
    5 neve;
    6 tempor;
    7 nubi;
    8 visib
    9 zerot-400
    10 hgt
    11 rh
    12 alte
    13 medie
    14 basse
    15 vento
    */
    if(isset($_POST['tau']))
    	$tau=$_POST['tau'];
    else
    	$tau=4;  
    $arraytou=array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
    $arraytouplus=array(4=>9, 5=>12, 6=>15, 7=>18, 8=>21, 9=>24, 10=>27, 11=>30, 12=>33, 13=>36, 14=>39, 15=>42, 16=>45, 17=>48, 18=>51, 19=>54, 20=>57, 21=>60, 22=>63, 23=>66, 24=>69, 25=>72);
    
    
    $posizionitop=array(0,50,165,290,390,465,25,130,250,355,60,175,250,325,420,35,135,215,345,430,35,100,190,275,115,250,75,175,235);
    $posizionileft=array(0,45,55,65,85,150,175,170,185,190,280,250,305,275,255,375,325,385,355,365,490,420,475,440,520,530,590,565,615);
    $valround = array("00" => array(8,9,10,11,16,17,18,19,24,25), "06" => array(6,7,8,9,14,15,16,17,22,23,24,25), "12" => array(4,5,6,7,12,13,14,15,20,21,22,23), "18" => array(4,5,10,11,12,13,18,19,20,21));
    Qualche idea?? In pratica a me serve che la mappa resti di sfondo e che le posizioni restino invariate... ho visto che il tuo script aveva cambiato le scritte con una "string e un numero" prima

    Grazie ancora

  7. #7
    penso possa servire... nel php alla fine i testoround vengono richiamati in un form così:

    codice:
    <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">  <table style="width: 100%">
        <tr>
          <td width="89%"><label for="tau"></label>
            <select name="tau" id="tau" onchange="this.form.submit()">
    		  <option value="4" <?php if($tau==4) echo "selected";?>><?php echo $testoround[$round][4]; ?></option>
              <option value="5" <?php if($tau==5) echo "selected";?>><?php echo $testoround[$round][5]; ?></option>
              <option value="6" <?php if($tau==6) echo "selected";?>><?php echo $testoround[$round][6]; ?></option>
              <option value="7" <?php if($tau==7) echo "selected";?>><?php echo $testoround[$round][7]; ?></option>
              <option value="8" <?php if($tau==8) echo "selected";?>><?php echo $testoround[$round][8]; ?></option>
              <option value="9" <?php if($tau==9) echo "selected";?>><?php echo $testoround[$round][9]; ?></option>
              <option value="10" <?php if($tau==10) echo "selected";?>><?php echo $testoround[$round][10]; ?></option>
              <option value="11" <?php if($tau==11) echo "selected";?>><?php echo $testoround[$round][11]; ?></option>
              <option value="12" <?php if($tau==12) echo "selected";?>><?php echo $testoround[$round][12]; ?></option>
              <option value="13" <?php if($tau==13) echo "selected";?>><?php echo $testoround[$round][13]; ?></option>
              <option value="14" <?php if($tau==14) echo "selected";?>><?php echo $testoround[$round][14]; ?></option>
              <option value="15" <?php if($tau==15) echo "selected";?>><?php echo $testoround[$round][15]; ?></option>
              <option value="16" <?php if($tau==16) echo "selected";?>><?php echo $testoround[$round][16]; ?></option>
              <option value="17" <?php if($tau==17) echo "selected";?>><?php echo $testoround[$round][17]; ?></option>
              <option value="18" <?php if($tau==18) echo "selected";?>><?php echo $testoround[$round][18]; ?></option>
              <option value="19" <?php if($tau==19) echo "selected";?>><?php echo $testoround[$round][19]; ?></option>
              <option value="20" <?php if($tau==20) echo "selected";?>><?php echo $testoround[$round][20]; ?></option>
              <option value="21" <?php if($tau==21) echo "selected";?>><?php echo $testoround[$round][21]; ?></option>
              <option value="22" <?php if($tau==22) echo "selected";?>><?php echo $testoround[$round][22]; ?></option>
              <option value="23" <?php if($tau==23) echo "selected";?>><?php echo $testoround[$round][23]; ?></option>
              <option value="24" <?php if($tau==24) echo "selected";?>><?php echo $testoround[$round][24]; ?></option>
              <option value="25" <?php if($tau==25) echo "selected";?>><?php echo $testoround[$round][25]; ?></option>
            </select></td>
        </tr>
      </table>
    </form>

  8. #8
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    La tua domanda era di rimpiazzare un testo da una data. Lo script che ho postato lo fa.

    Scrivi "con la tua modifica mi sparisce la cartina di fondo della pagina e mi appaiono le scritte". Quale cartina, quali scritte ?
    Comunque 1. La "mia modifica" cambia valori all'interno di un array non modifica per nulla lo script html.
    Comunque 2. Il codice che hai postato non aiuta molto in quanto incompleto.
    Comunque 3. Capirai che questo non è il mio lavoro e che non posso (nè voglio) studiarmi una marea di codice.
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  9. #9
    Quote Originariamente inviata da badaze Visualizza il messaggio
    La tua domanda era di rimpiazzare un testo da una data. Lo script che ho postato lo fa.

    Scrivi "con la tua modifica mi sparisce la cartina di fondo della pagina e mi appaiono le scritte". Quale cartina, quali scritte ?
    Comunque 1. La "mia modifica" cambia valori all'interno di un array non modifica per nulla lo script html.
    Comunque 2. Il codice che hai postato non aiuta molto in quanto incompleto.
    Comunque 3. Capirai che questo non è il mio lavoro e che non posso (nè voglio) studiarmi una marea di codice.
    2 post fa ho messo l'inizio dello script... se vedi richiama una mappa di background
    codice:
    <metahttp-equiv="Content-Type"content="text/html; charset=utf-8"><style>#mappa{
        background-image:url(testmeteo2/triv.jpg);
        width:720px;
        height:526px;
        position: relative;
    }
    </style>



    Facendo la tua modifica la mappa scompare e al suo posto appaiono le scritte modificate del testoround così:

    codice:
    array(4) { ["00"]=> array(22) { [4]=> string(22) "22 Gennaio 16 ore 7>10" [5]=> string(23) "22 Gennaio 16 ore 10>13" [6]=> string(23) "22 Gennaio 16 ore 13>16" [7]=> string(23) "22 Gennaio 16 ore 16>19" [8]=> string(23) "22 Gennaio 16 ore 19>22" [9]=> string(40) "22 Gennaio 16/
    23 Gennaio 16 ore 22>1" [10]=> string(21) "23 Gennaio 16 ore 1>4" [11]=> string(21) "23 Gennaio 16 ore 4>7" [12]=> string(22) "23 Gennaio 16 ore 7>10" [13]=> string(23) "23 Gennaio 16 ore 10>13" [14]=> string(23) "23 Gennaio 16 ore 13>16" [15]=> string(23) "23 Gennaio 16 ore 16>19" [16]=> string(23) "23 Gennaio 16 ore 19>22" [17]=> string(40) "23 Gennaio 16/
    24 Gennaio 16 ore 22>1" [18]=> string(21) "24 Gennaio 16 ore 1>4" [19]=> string(21) "24 Gennaio 16 ore 4>7" [20]=> string(22) "24 Gennaio 16 ore 7>10" [21]=> string(23) "24 Gennaio 16 ore 10>13" [22]=> string(23) "24 Gennaio 16 ore 13>16" [23]=> string(23) "24 Gennaio 16 ore 16>19" [24]=> string(23) "24 Gennaio 16 ore 19>22" [25]=> string(40) "24 Gennaio 16/
    25 Gennaio 16 ore 22>1" } ["06"]=> array(22) { [4]=> string(23) "22 Gennaio 16 ore 13>16" [5]=> string(23) "22 Gennaio 16 ore 16>19" [6]=> string(23) "22 Gennaio 16 ore 19>22" [7]=> string(40) "22 Gennaio 16/
    23 Gennaio 16 ore 22>1" [8]=> string(21) "23 Gennaio 16 ore 1>4" [9]=> string(21) "23 Gennaio 16 ore 4>7" [10]=> string(22) "23 Gennaio 16 ore 7>10" [11]=> string(23) "23 Gennaio 16 ore 10>13" [12]=> string(23) "23 Gennaio 16 ore 13>16" [13]=> string(23) "23 Gennaio 16 ore 16>19" [14]=> string(23) "23 Gennaio 16 ore 19>22" [15]=> string(40) "23 Gennaio 16/
    24 Gennaio 16 ore 22>1" [16]=> string(21) "24 Gennaio 16 ore 1>4" [17]=> string(21) "24 Gennaio 16 ore 4>7" [18]=> string(22) "24 Gennaio 16 ore 7>10" [19]=> string(23) "24 Gennaio 16 ore 10>13" [20]=> string(23) "24 Gennaio 16 ore 13>16" [21]=> string(23) "24 Gennaio 16 ore 16>19" [22]=> string(23) "24 Gennaio 16 ore 19>22" [23]=> string(40) "24 Gennaio 16/
    25 Gennaio 16 ore 22>1" [24]=> string(21) "25 Gennaio 16 ore 1>4" [25]=> string(21) "25 Gennaio 16 ore 4>7" } [12]=> array(22) { [4]=> string(23) "22 Gennaio 16 ore 19>22" [5]=> string(36) "22 Gennaio 16/23 Gennaio 16 ore 22>1" [6]=> string(21) "23 Gennaio 16 ore 1>4" [7]=> string(21) "23 Gennaio 16 ore 4>7" [8]=> string(22) "23 Gennaio 16 ore 7>10" [9]=> string(23) "23 Gennaio 16 ore 10>13" [10]=> string(23) "23 Gennaio 16 ore 13>16" [11]=> string(23) "23 Gennaio 16 ore 16>19" [12]=> string(23) "23 Gennaio 16 ore 19>22" [13]=> string(40) "23 Gennaio 16/
    24 Gennaio 16 ore 22>1" [14]=> string(21) "24 Gennaio 16 ore 1>4" [15]=> string(21) "24 Gennaio 16 ore 4>7" [16]=> string(22) "24 Gennaio 16 ore 7>10" [17]=> string(23) "24 Gennaio 16 ore 10>13" [18]=> string(23) "24 Gennaio 16 ore 13>16" [19]=> string(23) "24 Gennaio 16 ore 16>19" [20]=> string(23) "24 Gennaio 16 ore 19>22" [21]=> string(40) "24 Gennaio 16/
    
    
    
    


    Qui il codice completo se hai ancora voglia di provare

    codice:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>
    #mappa{
    	background-image:url(testmeteo2/triv.jpg);
    	width:720px;
    	height:526px;
    	position: relative;
    }
    </style>
    
    
    <?php
    /*
    0 round;
    1 id;
    2 tau;
    3 temp;
    4 prec;
    5 neve;
    6 tempor;
    7 nubi;
    8 visib
    9 zerot-400
    10 hgt
    11 rh
    12 alte
    13 medie
    14 basse
    15 vento
    */
    if(isset($_POST['tau']))
    	$tau=$_POST['tau'];
    else
    	$tau=4;  
    $arraytou=array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
    $arraytouplus=array(4=>9, 5=>12, 6=>15, 7=>18, 8=>21, 9=>24, 10=>27, 11=>30, 12=>33, 13=>36, 14=>39, 15=>42, 16=>45, 17=>48, 18=>51, 19=>54, 20=>57, 21=>60, 22=>63, 23=>66, 24=>69, 25=>72);
    
    
    $posizionitop=array(0,50,165,290,390,465,25,130,250,355,60,175,250,325,420,35,135,215,345,430,35,100,190,275,115,250,75,175,235);
    $posizionileft=array(0,45,55,65,85,150,175,170,185,190,280,250,305,275,255,375,325,385,355,365,490,420,475,440,520,530,590,565,615);
    $valround = array("00" => array(8,9,10,11,16,17,18,19,24,25), "06" => array(6,7,8,9,14,15,16,17,22,23,24,25), "12" => array(4,5,6,7,12,13,14,15,20,21,22,23), "18" => array(4,5,10,11,12,13,18,19,20,21));
    
    
    $testoround = array("00" => array(4=>"Oggi ore 7>10", 5=>"Oggi ore 10>13", 6=>"Oggi ore 13>16", 7=>"Oggi ore 16>19", 8=>"Oggi ore 19>22", 9=>"Oggi/<br>Domani ore 22>1", 10=>"Domani ore 1>4", 11=>"Domani ore 4>7", 12=>"Domani ore 7>10", 13=>"Domani ore 10>13", 14=>"Domani ore 13>16", 15=>"Domani ore 16>19", 16=>"Domani ore 19>22", 17=>"Domani/<br>Dopodomani ore 22>1", 18=>"Dopodomani ore 1>4", 19=>"Dopodomani ore 4>7", 20=>"Dopodomani ore 7>10", 21=>"Dopodomani ore 10>13", 22=>"Dopodomani ore 13>16", 23=>"Dopodomani ore 16>19", 24=>"Dopodomani ore 19>22", 25=>"Dopodomani/<br>Terzo giorno ore 22>1"),"06" => array(4=>"Oggi ore 13>16", 5=>"Oggi ore 16>19", 6=>"Oggi ore 19>22", 7=>"Oggi/<br>Domani ore 22>1", 8=>"Domani ore 1>4", 9=>"Domani ore 4>7", 10=>"Domani ore 7>10", 11=>"Domani ore 10>13", 12=>"Domani ore 13>16", 13=>"Domani ore 16>19", 14=>"Domani ore 19>22", 15=>"Domani/<br>Dopodomani ore 22>1", 16=>"Dopodomani ore 1>4", 17=>"Dopodomani ore 4>7", 18=>"Dopodomani ore 7>10", 19=>"Dopodomani ore 10>13", 20=>"Dopodomani ore 13>16", 21=>"Dopodomani ore 16>19", 22=>"Dopodomani ore 19>22", 23=>"Dopodomani/<br>Terzo giorno ore 22>1", 24=>"Terzo giorno ore 1>4", 25=>"Terzo giorno ore 4>7"),"12" => array(4=>"Oggi ore 19>22", 5=>"Oggi/Domani ore 22>1", 6=>"Domani ore 1>4", 7=>"Domani ore 4>7", 8=>"Domani ore 7>10", 9=>"Domani ore 10>13", 10=>"Domani ore 13>16", 11=>"Domani ore 16>19", 12=>"Domani ore 19>22", 13=>"Domani/<br>Dopodomani ore 22>1", 14=>"Dopodomani ore 1>4", 15=>"Dopodomani ore 4>7", 16=>"Dopodomani ore 7>10", 17=>"Dopodomani ore 10>13", 18=>"Dopodomani ore 13>16", 19=>"Dopodomani ore 16>19", 20=>"Dopodomani ore 19>22", 21=>"Dopodomani/<br>Terzo Giorno ore 22>1", 22=>"Terzo Giorno ore 1>4", 23=>"Terzo Giorno ore 4>7", 24=>"Terzo Giorno ore 7>10", 25=>"Terzo Giorno ore 10>13"),"18" => array(4=>"Oggi ore 1>4", 5=>"Oggi ore 4>7", 6=>"Oggi ore 7>10", 7=>"Oggi ore 10>13", 8=>"Oggi ore 13>16", 9=>"Oggi ore 16>19", 10=>"Oggi ore 19>22", 11=>"Oggi/<br>Domani ore 22>1", 12=>"Domani ore 1>4", 13=>"Domani ore 4>7", 14=>"Domani ore 7>10", 15=>"Domani ore 10>13", 16=>"Domani ore 13>16", 17=>"Domani ore 16>19", 18=>"Domani ore 19>22", 19=>"Domani/<br>Dopodomani ore 22>1", 20=>"Dopodomani ore 1>4", 21=>"Dopodomani ore 4>7", 22=>"Dopodomani ore 7>10", 23=>"Dopodomani ore 10>13", 24=>"Dopodomani ore 13>16", 25=>"Dopodomani ore 16>19")
    );
    $row = 1;
    $unavolta = 0;
    if (($handle = fopen("http://www.wrfnordestmeteo.it/d02htm/dati.txt", "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $num = count($data);
    		$row++;
    		
            for ($c=0; $c < $num; $c++) {
                $valori=explode(";",$data[$c]);
    			
    			if(($unavolta==0)&($valori[2]==$tau)){
    				$round=substr($valori[0], 9, 2);
    				echo "<div id=\"mappa\">";
    				echo "<h2 style=\"position:fixed; top:390px; left:480px; color:#FFFFFF;\">".$testoround[$round][$valori[2]]."<h2>";
    				$unavolta=1;
    			}
    }}
        }
        fclose($handle);
    }
    ?>
    </div>
    <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
      <table style="width: 100%">
        <tr>
          <td width="89%"><label for="tau"></label>
            <select name="tau" id="tau" onchange="this.form.submit()">
    		  <option value="4" <?php if($tau==4) echo "selected";?>><?php echo $testoround[$round][4]; ?></option>
              <option value="5" <?php if($tau==5) echo "selected";?>><?php echo $testoround[$round][5]; ?></option>
              <option value="6" <?php if($tau==6) echo "selected";?>><?php echo $testoround[$round][6]; ?></option>
              <option value="7" <?php if($tau==7) echo "selected";?>><?php echo $testoround[$round][7]; ?></option>
              <option value="8" <?php if($tau==8) echo "selected";?>><?php echo $testoround[$round][8]; ?></option>
              <option value="9" <?php if($tau==9) echo "selected";?>><?php echo $testoround[$round][9]; ?></option>
              <option value="10" <?php if($tau==10) echo "selected";?>><?php echo $testoround[$round][10]; ?></option>
              <option value="11" <?php if($tau==11) echo "selected";?>><?php echo $testoround[$round][11]; ?></option>
              <option value="12" <?php if($tau==12) echo "selected";?>><?php echo $testoround[$round][12]; ?></option>
              <option value="13" <?php if($tau==13) echo "selected";?>><?php echo $testoround[$round][13]; ?></option>
              <option value="14" <?php if($tau==14) echo "selected";?>><?php echo $testoround[$round][14]; ?></option>
              <option value="15" <?php if($tau==15) echo "selected";?>><?php echo $testoround[$round][15]; ?></option>
              <option value="16" <?php if($tau==16) echo "selected";?>><?php echo $testoround[$round][16]; ?></option>
              <option value="17" <?php if($tau==17) echo "selected";?>><?php echo $testoround[$round][17]; ?></option>
              <option value="18" <?php if($tau==18) echo "selected";?>><?php echo $testoround[$round][18]; ?></option>
              <option value="19" <?php if($tau==19) echo "selected";?>><?php echo $testoround[$round][19]; ?></option>
              <option value="20" <?php if($tau==20) echo "selected";?>><?php echo $testoround[$round][20]; ?></option>
              <option value="21" <?php if($tau==21) echo "selected";?>><?php echo $testoround[$round][21]; ?></option>
              <option value="22" <?php if($tau==22) echo "selected";?>><?php echo $testoround[$round][22]; ?></option>
              <option value="23" <?php if($tau==23) echo "selected";?>><?php echo $testoround[$round][23]; ?></option>
              <option value="24" <?php if($tau==24) echo "selected";?>><?php echo $testoround[$round][24]; ?></option>
              <option value="25" <?php if($tau==25) echo "selected";?>><?php echo $testoround[$round][25]; ?></option>
            </select></td>
        </tr>
      </table>
    </form>
    Grazie per averci provato finora e se vorrai provarci ancora
    ciao

  10. #10
    nessuno riesci ad aiutarmi?

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 © 2025 vBulletin Solutions, Inc. All rights reserved.