SV: [PHP] nested includes()...
| From: | anders nawroth | Date: | Tue, 09 Oct 2001 19:23:07 +0000 |
| Subject: | SV: [PHP] nested includes()... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70530@lists.php.net to get a copy of this message | ||
I use this solution:
Directory structure:
.../xxx/wwwroot/dir1/index.php
.../xxx/wwwroot/dir2/index.php
.../xxx/outside-www-area/engine/engine.php // includes libs used in all scripts
.../xxx/outside-www-area/document/dir1/ // docs only for /dir1/
.../xxx/outside-www-area/document/dir2/ // docs only for /dir2/
index.php just sets two variables,
$ENGINE and $DOCUMENT,
(use the path to the script itself) and then
calls include ($ENGINE . 'engine.php').
This script then uses
include ($DOCUMENT . 'xyz.inc'); and the like
to print out headers and footers and all other stuff.
This way I can have identical scripts on a
win98 (dev) and a Linux (prod) environment.
The paths are completely different, but
that doesn't matter.
You could use this also with includes
inside the www area, but thats not so good
for security reasons.
Anders Nawroth
webmaster
www.bibbi.nawroth.com
----- Ursprungligt meddelande -----
Från: "Christian Dechery" <cdechery@easynet.com.br>
Till: "Jason G." <blair@nb.net>
Kopia: <php-general@lists.php.net>
Skickat: den 9 oktober 2001 19:33
Ämne: Re: [PHP] nested includes()...
that way if the include dir changes I have to go trough each file to change
it??
that doesn't solve my problem at all...
At 23:00 08/10/01 -0400, Jason G. wrote:
>Alas, I have your solution!
>
>I have gotten around this very problem by saying at the top of a script:
>
>define(_INCLUDE_DIR, '/home/pad/include/'); //note trailing slash
>
>Anytime i include a file:
>include(_INCLUDE_DIR . "lib.data.php");
>
>It works always.
>
>-Jason Garber
>IonZoft.com
>
>
>
>At 10:20 PM 10/8/2001 -0300, Christian Dechery wrote:
>>I have a file x.php that includes a.inc, and a.inc includes b.inc...
>>
>>if I have a file dir/z.php including ../a.inc it doesn't work cuz it
>>won't find b.inc...
>>
>>how can I get around this???
>>
>>
>>_____________________________
>>. Christian Dechery
>>. . Gaita-L Owner / Web Developer
>>. . http://www.webstyle.com.br
>>. . http://www.tanamesa.com.br
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>>For additional commands, e-mail: php-general-help@lists.php.net
>>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net