Re: help with fopen path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux