Re: Setting include path to same directory as .php file.?

From: Date: Wed, 29 Nov 2000 20:24:38 +0000
Subject: Re: Setting include path to same directory as .php file.?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-27870@lists.php.net to get a copy of this message
I left out a small detail - I don't control all of the files in ../ I have a photo gallery program that I am trying to make compatible with PHP-Nuke so it can be dropped in as a plug-in package. It works today but you have to put the main PHP file for my stuff in the main PHP-Nuke directory - it can find everything else in its own subdirectory. Ideally I would like it to be all contained in a subdirectory instead. -dan Previously, Daniel Convissor said: > Dan: > > Dan Lowe wrote: > > > > simply include "../header.php" for example, but then it tries to include > > one or more other files and then it fails because they aren't in '.' with > > my script. > > The include_path doesn't need to be set in your php.ini. What may be > tripping you up is trying to include files from the wrong directories. Note, > all directory requests are relative to the INITIAL PHP script called. So, > you'll have to call things like this: > > -------------- > <?php > # This file is /htdocs/someone/subdir/home.php > include("../head.inc"); > echo "That's it"; > ?> > > -------------- > <?php > # This file is /htdocs/someone/head.inc > # Note, "subhead.inc" is in the same dir as this file. > # BUT that doesn't matter. > # What matters is it's up one dir from "home.php." > include("../subhead.inc"); > echo "<title>Blah Co</title>"; > ?> > > -------------- > <?php > # This file is /htdocs/someone/subhead.inc > echo "<h1>Blah Co</h1>"; > ?> > > > If that's not solving things for you, the problem could be file permissions. > > Good luck, > > --Dan > > -- > PHP scripts that make your job easier > http://www.analysisandsolutions.com/code/ > SQL Solution | Layout Solution | Form Solution > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 > > > > -- > 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 > -- Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/ Computer : a million morons working at the speed of light. -David Ferrier

« previous php.general (#27870) next »