Re: require() in other directories?

From: Date: Thu, 18 Nov 2004 12:17:47 +0000
Subject: Re: require() in other directories?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-202409@lists.php.net to get a copy of this message
Peter Lauri wrote:
Best groupmember, I have an webapplication that uses different languages and therefor I have set up different directorys for each language. All languages use the same classes. The problem I have is when I want to require() the classfile I can not require a file that is not in the same directory as my .php file. I have tried the following: require("../classes.php"); require("http://www.mydomain.com/classes.php");
totally wrong!!!
and more. All gives me error messages, why?
the relative path in require must be reltaive to the _executing_ script NOT to the _included_ script! f.e. with classes.php in /webroot/ /webroot/index.php:
    require 'lang/en.php';
/webroot/lang/en.php:
    //WRONG:
    require '../classes.php';
    //RIGHT:
    require 'classes.php';
    // or
    require '/webroot/classes.php';
-- Sebastian Mendel www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet

« previous php.general (#202409) next »