Re: How can a module find a resource in its environment.

From: Date: Tue, 06 Jan 2004 18:26:11 +0000
Subject: Re: How can a module find a resource in its environment.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173876@lists.php.net to get a copy of this message
Hello Jost, Sunday, January 4, 2004, 3:09:41 PM, you wrote: JB> For example I have a module foo/a.php which is required by b.php via JB> require ("foo/a.php"). Unfortunately within the module a.php the cwd() JB> is not foo but the context of b.php. The easiest way to fix this would Makes sense. JB> be to define a new function my_require() which does a JB> chdir(basename(path)) before the module is included (or one could pass JB> an environment variable if chdir() is deprecated). Why not just define a global at the start of each file that holds its location? JB> BTW: Why is the syntax so that I have to give the full filename of the JB> module, not only the module name? For example a require("foo/a") should JB> also work, but currently doesn't. I guess PHP currently does not JB> support pre-compiled modules, does it? :) Because they're not really modules in the C sense, you're just including a file - the fact it's a PHP one isn't determined by PHP itself, nor by the file extension. You could be "requiring" an HTML document for all PHP cares :) -- Best regards, Richard mailto:rich@launchcode.co.uk

« previous php.general (#173876) next »