Re: help with fopen path

From: Date: Wed, 10 Nov 2004 01:20:10 +0000
Subject: Re: help with fopen path
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-201646@lists.php.net to get a copy of this message
Hi Giles,
I'm developing a fusebox PHP app and have a class in a /classes directory that opens an xml file in a directory below the site root using this path: "../siteconfig.xml" All of the places I have used this class from so far have been in the site root. I am now starting some pages in a sub directory. When I use this class it says it can't open the file. I have tried "../../siteconfig.xml" instead but it doesn't work either. What's the best way to go about fixing this? I'm quite new to php and I'm not sure where the relative path is taken from - i.e. is it the index.php page or the class (obviously not) or my switch file or what?
You might want to set your global parameters (such as the full path to class files) in a config file which is auto_prepend'ed to each PHP script. That way you can always require_once( $GLOBALS['classPath'] . '/class.YourClass.php' ) regardless of your working directory. James McGlinn Project Manager BCom, BSc, Zend Certified Engineer (PHP) Servers.co.nz Ltd 68 Shortland St, Auckland PO Box 3688 Shortland St, Auckland, New Zealand Phone: 0800 4 SERVERS Fax: +64 9 358 5187

« previous php.general (#201646) next »