Re: Where to put my class files

From: Date: Tue, 28 Feb 2006 06:45:07 +0000
Subject: Re: Where to put my class files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-231186@lists.php.net to get a copy of this message
Peter Lauri wrote:
Best group member, I want to run the backend of the system under HTTPS for security reasons. The pages in HTTP and HTTPS are both using the same classfiles. Right now I have the class files in httpdocs/classes/ In the httpsdocs/admin I have a variable $class_path='http://www.mydomain.com/classes/'; to describe where the class files can be found. I do this that does not generate an error: require_once($class_path.'orderadmin.class.php');
Including them this way will have already processed the php. It's like viewing the file using a browser.
When I then do below it gives be an error. echo OrderAdmin::getNewOrderList(); Fatal error: Undefined class name 'orderadmin' in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46 When running on the localhost and with the admin in a subfolder in HTTP it is no problems. Where should I locate my class files so that they are visible for both HTTP and HTTPS? And how should I set my $class_path? I do not think my $class_path is good enoght, because then I would not have that problem. I have tried: $class_path='../../http/classes/';
You need to do something like: // this gives you /home/httpd/vhosts/mydomain.com/httpsdocs/admin $my_path = dirname(__FILE__); // go back to the other folder. $class_path = $my_path . '/../../httpdocs/classes/'; -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#231186) next »