[thelist] PHP includes (how to call from subdir)

Aleem Bawany aleem.bawany at utoronto.ca
Mon Dec 9 23:52:48 CST 2002


> On Behalf Of Howard Cheng
> Sent: Monday, December 09, 2002 11:26 PM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] PHP includes (how to call from subdir)
>
> Another option is to use the $DOCUMENT_ROOT variable (or
> $_SERVER['DOCUMENT_ROOT']) which is the physical path to your web root
> directory:
>
> include($_SERVER['DOCUMENT_ROOT']."/something.php");
>

tried that, but failed. I think it's because it ends up search for a
folder called /apache/htdocs.... within the includes folder, even if
when it is preceded with a c:/, but this might be because my php and
docroot are on different drives.

On Sat, 7 Dec 2002 10:18:04 -0500 j.d. welch wrote:

> sure, you can do it like that, but i think it's worth mentioning that
> you can change the include_path directive per directory. in an
> .htaccess file in your DocumentRoot, add something like:
>
> php_value include_path=".:/path/to/my/includes:/some/other/path"

that's a good suggestion, I'm trying to get php running as a module
rather than a CGI install, to get this working. Lots of my scripts are
breaking up so I have to work out the problems. I'll give it a shot on
m.e.o the next time I meddle with my code.


> From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]
> On Behalf Of Garrett Coakley
>
> Another method, if you have a self contained app is to define some
> constants in a master configuration file that outline your directories
> and then just include the config file in each of the application
files.
>

that's another good one. I just discovered smarty (smarty.php.net) and
did an extended install of their module. It looks great (at first I had
mixed feelings but now I'm starting to like it - the plugins are great
esp the stripwhitespace... beautiful). That's the approach they take
too. (and I didn't know PHP had such great support for classes and
extending classes and taking adress of parameters...)

aleem

http://members.evolt.org/aleem/





More information about the thelist mailing list