You are here: Re: includes and paths and organization « PHP Programming Language « IT news, forums, messages
Re: includes and paths and organization

Posted by John Murtari on 09/26/07 17:26

Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> writes:


> I prefer making one or two directories where I store my includes, and
> simply add them to the include path. This makes things easy to manage.
>
> You can use ini_set, eg:
> $newIncludePath =
> get_include_path().PATH_SEPARATOR.'/home/bla/public_html/includes';
>
> ini_set("include_path",$newIncludePath);
>
>
> You only need 1 file you include everywhere in all your scripts that
> contains this, and you are fine.
> If you ever move your directorytree, just adjust the path.
>
> Now you can simply include everything that is stored under
> /home/bla/public_html/includes, and also its subdirectories (if you
> name them during your include).
>

I would vote for Erwin's solution since it will give you
much more flexibility in include location. Readup on "include_path"
in on the php web site; also, some people may now know that you can use
relative paths in the include_path directive, so this is okay:

include_path = ".:lib:../lib:../../lib"

NOTE, the "." is added first since the normal PHP use of the include_path
is to search the include_path FIRST, if the file is not found along those
paths, look in the default dir (which is usually what you might not expect).

Hope this helps.

--
John
___________________________________________________________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация