Re: nested includes()...
| From: | Andrey Hristov | Date: | Tue, 09 Oct 2001 11:06:10 +0000 |
| Subject: | Re: nested includes()... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70444@lists.php.net to get a copy of this message | ||
Good style is to have a central scripts with defines such
define("SITE_HTML","/var/www/virtual/www.mysite.com/private/html")
and so on for every such dir
using
<?php
include SITE_HTML."login.html";
?>
In every directory on your visible part of the web server paste a file with
name like this : link_to_defs.php which includes the central script so you
can place the central script anywhere in your server.
Every script must include/require "link_to_defs.php" and everything will be
good, after that you can use your defines. If you want to move your script
to another location, there is no problem if in the new place there are
link_to_defs.php
Andrey Hristov
Web Developer
IcyGEN Corporation
BALANCED SOLUTIONS
http://www.icygen.com
On Tuesday 09 October 2001 13:54, you 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???
>
> in file dir/z.php do:
>
> <?
> chdir( ".." );
> include( "a.inc" );
> chdir( "dir" );
> ?>
>
> This way all included files have proper current working
> directory and are able to include anything else (not depending
> on above 'dir' directory structure, so it's movable structure).
> The only problem is that 'z.php' has to be aware that it's in 'dir'
> directory.
>
> Kamil 'Hilarion' Nowicki
--