Visualizzazione dei risultati da 1 a 2 su 2

Discussione: function date

  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2010
    Messaggi
    31

    function date

    Ciao a tutti.

    Ho questo codice a cui devo aggiungere la variabile per la lingua tedesca.
    Che funzionerebbe nel medesimo modo di quella italiana.
    Basta che all' if ($lingua=="it") aggiungo OR ? così ?
    Codice PHP:
    if ($lingua=="it" or "de"
    Ho provato ma no funziona, mi sballa la lingua inglese...
    Codice PHP:
    # se $sw_ora è 1 mette anche l'ora
    # se $sw_trunk è 1 tronca le descrizioni di giorno e mese a tre caratteri 
    # $format identifica il tipo di formattazione richiesta; 
    #    1 --> weekday . " " . $giorno . " " . $nomemese . " " . $anno . "
    #    2 --> weekday . " " . $nomemese . " " . $giorno . " - " . $anno . "

    if ($sw_ora=="1") {
      if (
    $lingua=="it"){
        
    $fdata=$weekday1 " " $giorno " " $nomemese1 " " $anno "
    Ore: " 
    $ora ":" $minuti ":" $secondi;
      } else {
        switch (
    $format) {
        case 
    "1":
          
    $fdata=$weekday1 " " $giorno " " $nomemese1 " " $anno "
    Ore: " 
    $ora ":" $minuti ":" $secondi;
        break;
        case 
    "2":
          
    $fdata=$weekday1 " " $nomemese1 " " $giorno " - " $anno "
    Time: " 
    $ora ":" $minuti ":" $secondi;
        break;
        }
      }
    } else {
      if (
    $lingua=="it"){
        
    $fdata=$weekday1 " " $giorno " " $nomemese1 " " $anno;
      } else {
        switch (
    $format) {
        case 
    "1":
          
    $fdata=$weekday1 " " $giorno " " $nomemese1 " " $anno;
        break;
        case 
    "2":
          
    $fdata=$weekday1 " " $nomemese1 " " $giorno " - " $anno;
        break;
        }
      }
    }

    return 
    $fdata;



  2. #2
    Ciao,

    l'if è sbagliato, la sintassi giusta è :
    Codice PHP:
    if ($lingua =="it" or $lingua == "de"
    CODENCODE \ Branding \ Design \ Marketing
    www.codencode.it

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.