[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-windows
Subject:    Re: [PHP-WIN] php include problem
From:       trystano () aol ! com
Date:       2007-03-31 12:19:34
Message-ID: 8C941A5FA6C8A4A-19E0-4069 () FWM-R05 ! sysops ! aol ! com
[Download RAW message or body]


 Yeah, thats the best way, to use a constant as you will only need to change it in \
one place if the location of the images need to change in the future. Also, I \
would'nt hard code your domain into the location path of the images as they won't \
work locally for testing (localhost). You probs best off using the variables that \
fall under $_SERVER for determining your application root.  
 Tryst
    
 -----Original Message-----
 From: styve.couture@novo.ca
 To: php-windows@lists.php.net
 Sent: Thu, 29 Mar 2007 12.38PM
 Subject: RE: [PHP-WIN] php include problem
 
  I do this little trick in the main file I include in all my php files. So after 
that, I only use the constants regardless how deep I am in a folder.

//pour trouver comment/ou inclure les fichiers peut importe l'emplacement du 
fichier appelant
    if (!defined("SERVER_ROOT_PATH"))
    {    
        settype($str_pathUp, "string");
        $str_pathUp = str_repeat("../", substr_count($_SERVER['PHP_SELF'], 
"/")-2);    
        //on construit le chemin des fichiers       
        DEFINE("SERVER_ROOT_PATH", $str_pathUp);
        DEFINE("SERVER_FILE_PATH", SERVER_ROOT_PATH."fichier/");
        DEFINE("SERVER_INCLUDEFILE_PATH", SERVER_ROOT_PATH."includeFiles/");
        DEFINE("SERVER_IMAGE_PATH", SERVER_ROOT_PATH."image/");
        DEFINE("SERVER_CSS_PATH", SERVER_ROOT_PATH."css/");
        DEFINE("SERVER_TEMP_PATH", SERVER_ROOT_PATH."temp/");
        DEFINE("SERVER_LOG_PATH", SERVER_ROOT_PATH."log/");
        DEFINE("SERVER_CLASS_PATH", SERVER_ROOT_PATH."classe/");
        DEFINE("SERVER_ADODB_CLASS_PATH", SERVER_CLASS_PATH."adodb/");
        DEFINE("SERVER_MAIL_CLASS_PATH", SERVER_CLASS_PATH."mail/");
        DEFINE("SERVER_NEWMAIL_CLASS_PATH", SERVER_CLASS_PATH."phpmailer/");
        DEFINE("SERVER_ERROR_CLASS_PATH", SERVER_CLASS_PATH."errorHandler/");
        DEFINE("SERVER_SESSION_CLASS_PATH", SERVER_CLASS_PATH."session/");
        DEFINE("SERVER_SQL_CLASS_PATH", SERVER_CLASS_PATH."sqlWrapper/");
    }
    
    // Fonctions générales nécessaires à certaines classes.
    include_once(SERVER_INCLUDEFILE_PATH.'module_fonction_generale.php');





-----Message d'origine-----
De  : Niel Archer [mailto:Niel Archer] De la part de Niel Archer
Envoyé  : 28 mars 2007 21:32
À  : php-windows@lists.php.net
Objet  : Re: [PHP-WIN] php include problem

Hi

> When including try using ./new/images instead of /new/images
> 
> the . should tell it to start at root level.

No. the '.' tells it to start at current directory. '../' would tell it
to start at the parent directory (one level higher) so:

 "../images/"
 would work in this example.

bob's advice to use absolute paths would be safest though...

"www.your-domain.com/images/"



Niel

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic