Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    includere un file diverso a seconda risoluzione

    sto creando un layout fluido con i css, l'unico elemento che non si ridimensiona e l'header perchè ha immagini all'interno, vorrei quindi creare 3 header diversi, a seconda della risoluzione viene incluso l'header esatto

    facendo una cosa simile e mettendola tra tag head:

    <SCRIPT>
    function header()
    {
    var w = screen.width;

    if((w>=800) && (w<=1023))
    {
    header=800;
    }

    else if ((w>=1024) && (w<=1279))
    {
    header=1200;
    }

    else if ((w>=1280) && (w<=1439))
    {
    header=1280;
    }
    }
    </SCRIPT>

    poi come faccio ad utilizzare quella variabile nell'include di php?
    ho fatto diversi tentativi ma non funziona

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    Codice PHP:

    <?php
    if (isset($_GET['width']) AND isset($_GET['height'])) {
      
    // output the geometry variables
      //echo "Screen width is: ". $_GET['width'] ."
    \n";
      //echo "
    Screen height is". $_GET['height'] ."
    \n";
    } else {
      // pass the geometry variables
      // (preserve the original query string
      //   -- post variables will need to handled differently)

      echo "
    <script language=\"javascript\">\n";
      echo 
    "  location.href=\"${_SERVER['SCRIPT_NAME']}?${_SERVER['QUERY_STRING']}"
                
    "&width=\" + screen.width + \"&height=\" + screen.height;\n";
      echo 
    "</script>\n";
      exit();
    }
    ?>
    Bada però che basta avere javascript disabilitato e casca il palco...
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

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.