Visualizzazione dei risultati da 1 a 6 su 6

Discussione: semplice include

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2006
    Messaggi
    5

    semplice include

    Sto iniziando... scusatemi...

    Al primo include già va tutto a scatafascio

    Codice PHP:
    <?php include "rgnclock";?>
    e lo script....

    Codice PHP:
    <?php
    /*
    RGNClock
    Version 1.0
    */
    $twentyfourhours "off"// Set to "on" if you would like 24x7 Hours such as
                              // 15:00 Hours.  The default is AM\PM

    $giflocation "http://localhost/clock/"// This is where your GIF files are located
                                                       // Remember to include the trailing slash

    // get the current time of server
    $time_stamp getdate();

    // calculate hour to display
    if($twentyfourhours == "on"// whether to display 24x7, if true, convert
            
    $hour date ("H"); //24x7 hours
    else
         
    $hour date ("g"); //12 hours

    // calculate minutes to display
    $minutes date ("i");

    // display hours
    if(strlen(strval($hour)) < 2){
         echo 
    "<IMG SRC=\"".$giflocation.$hour.".gif"."\">";}
    else{
         echo 
    "<IMG SRC=\"".$giflocation.substr($hour01).".gif"."\">";
         echo 
    "<IMG SRC=\"".$giflocation.substr($hour11).".gif"."\">";
    }

    // display colon
    echo "<IMG SRC=\"".$giflocation."colon.gif"."\">";

    // display minutes
    echo "<IMG SRC=\"".$giflocation.substr($minutes01).".gif"."\">";
    echo 
    "<IMG SRC=\"".$giflocation.substr($minutes11).".gif"."\">";

    // whether to display AM PM or not
    if($twentyfourhours != "on"){ // if true, will display AM or PM
            
    if(date("A") == "AM")
            echo 
    "<IMG SRC=\"".$giflocation."am.gif"."\">";
            else
            echo 
    "<IMG SRC=\"".$giflocation."pm.gif"."\">";
    }
    All'esecuzione: http://localhost/clock/
    ottengo:

    Warning: include(rgnclock) [function.include]: failed to open stream: No such file or directory in C:\WWW\clock\index.php on line 1

    Warning: include() [function.include]: Failed opening 'rgnclock' for inclusion (include_path='.;c:\php\includes') in C:\WWW\clock\index.php on line 1

    Naturalmente è tutto su http://localhost/clock/

    Credo che sia una questione di parametri PHP.ini o Apache
    ma non so dove mettere le mani
    Purtroppo con il search non ho combinato molto... grazie per l'aiuto

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    il file non ha estensione? non è che magari si chiama rgnclcok.php ?
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2006
    Messaggi
    5
    nella cartella /clock
    ci sono tutte le .gif
    index.php e rgnclock.php

  4. #4
    Utente di HTML.it
    Registrato dal
    Sep 2006
    Messaggi
    5
    preciso che quanto detto sopra vale solo se lo eseguo in locale..

    su un server remoto va tutto bene

  5. #5
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    Ma se il file si chiama rgnclock.php l'inclusione va fatta

    codice:
    <?php
      include("rgnclock.php");
    ?>
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  6. #6
    Utente di HTML.it
    Registrato dal
    Sep 2006
    Messaggi
    5
    Hai ragione!
    Grazie Andrea

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.