Re: another question on setting include paths for a project

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

 



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
========================================================================

-- 
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