Re: Require() using relative path
| From: | Ryan Adams | Date: | Thu, 27 Jul 2000 14:13:06 +0000 |
| Subject: | Re: Require() using relative path | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8557@lists.php.net to get a copy of this message | ||
Sorry, I think I worded that one a bit shallowly.
Unfortunately, the path to the documents following $DOCUMENT_ROOT
will be different for almost every server. This is a big fat brick
wall. It's got to be possible to write a function like include_local
or something that can do from-this-file includes and not inherit it's
path from a parent including document.
methinks it's time for some one-to-one with the source...
Ryan
On Thu, Jul 27, 2000 at 09:35:37AM +0100, Matt Williams wrote:
> how about using
>
> include "$DOCUMENT_ROOT/inlcude/your_include_file";
>
> M@
>
> > -----Original Message-----
> > From: Ryan Adams [mailto:radams@fcs.uga.edu]
> > Sent: Wednesday, July 26, 2000 08:10
> > To: Rasmus Lerdorf
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] Require() using relative path
> >
> >
> > Ah yes. That will work.
> >
> > The question is still alive in my mind, however, from a
> > portability standpoint.
> > For instance, I would like to be able to easily port the code to
> > any server
> > that is running php4 and not require server changes. Part of this includes
> > explicity setting variables like magic_quotes and whatnot in a
> > header file.
> >
> > Is it also possible to set include_path in that manner?
> >
> > Thanks,
> > Ryan
> >
> >
> > On Tue, Jul 25, 2000 at 08:28:31AM -0700, Rasmus Lerdorf wrote:
> > > Just add the templates directory to your include_path and you
> > can do that.
> > >
> > > -Rasmus
> > >
> > > On Tue, 25 Jul 2000, Ryan Adams wrote:
> > >
> > > > Man, I'd like to see something like this too. I'm working on
> > a reporting
> > > > system that includes files with includes in them, across
> > several directories.
> > > > It would be really nice to have a function that did it
> > automatically...
> > > >
> > > > Would that go against the current architecture? How are
> > includes/requires
> > > > currently implemented?
> > > >
> > > > Ryan
> > > >
> > > >
> > > >
> > > > On Wed, Jul 19, 2000 at 05:37:07PM +0800, Ken M. Mevand wrote:
> > > > > hi folks,
> > > > > i'm just starting to program in php, so please forgive
> > me if this
> > > > > question is dumb.
> > > > >
> > > > > here is my file layout :
> > > > >
> > > > > index.php
> > > > > |- templates
> > > > > | |-default.php
> > > > > | |-welcome.php
> > > > >
> > > > > i called index.php which includes default.php, which in
> > turn includes
> > > > > welcome.php. can the 2nd include in default.php be done using
> > > > > require("welcome.php")
> > > > >
> > > > > instead of
> > > > > require("templates/welcome.php") ?
> > > > >
> > > > > -ken
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > 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
> > > > ---end quoted text---
> > > >
> > > >
> > ---end quoted text---
> >
> > --
> > 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
> >
---end quoted text---