Re: another question on setting include paths for a project

From: Date: Mon, 22 Mar 2010 14:51:38 +0000
Subject: Re: another question on setting include paths for a project
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-303088@lists.php.net to get a copy of this message
On Mon, 22 Mar 2010, Richard Quadling wrote: > Depending upon what is being included, an autoloader could help > here. > > The main payoffs for autoloading are reduced memory footprint (class > are loaded JIT) and no need for each class to know exactly where the > other classes are. > > So, your main page needs to load the autoloader and the autoloader > handles the loading of the classes. > > No need to change the include_path setting. ok, i'm looking at the PHP manual page for autoload, sample: function __autoload($class_name) { require_once $class_name . '.php'; } and some obvious questions suggest themselves: 1) in as simple an example as above, does the include_path still control the search? since i'm not doing anything fancy above in terms of specifying *where* that class is defined, it seems that i'll still have the same problem to solve, no? 2) i'm guessing that i can make the __autoload function as sophisticated as i want, in that i can have it consult an environment variable to determine where to search, but i'm still unsure as to how i can set an environment variable to be consulted on the "server" side. rday -- ======================================================================== Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Kernel Pedantry. Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday ========================================================================

« previous php.general (#303088) next »