Patrick Teague wrote:
> ok, so this makes alot of since...  if I move my website from one server to
> another server I'll have to go through every single file & redo the
> directory structure?  Isn't this the reason for the includes...  so you
> don't have to go through every single file to make changes?  Maybe I should
> go back to ASP...
> 
> #include virtual="/includes/myinclude.inc"
> 
> or is there a way to get this to work via php on apache?

Per http://www.php.net/manual/en/function.ini-set.php, PHP_INCLUDE_PATH 
is an 'ini' setting which you can change - you could either set it in 
your php.ini once, and point it to one common 'includes' direcotry.  Or 
possibly set it per apache virtual server (via .htaccess perhaps in a
main root directory).

Another thought is to simply make all your include statements use a
constant, such as DOCUMENT_ROOT or something else (we use something
else but the idea is the same).  Yes, all includes need to be written as

include(MYDIRPATH."/relative/stuff.php");

Also, try

ini_set(PHP_INCLUDE_PATH,DOCUMENT_ROOT);

at the top of your page(s).  That might do the trick.

but it makes everything a heck of a lot more portable.  Don't go back to 
ASP.  If you really want to use <!--#include virtual--> stuff Apache
supports that via .shtml files.  There are probably ways of getting the
two to work together (PHP and SSI) though I'm not sure why you'd want to 
do so.  :)  Remember ASP is a framework, and VBScript is the popular 
language there.  VBScript doesn't support includes at all - it's ASP 
calling an SSI interpreter, include()ing things, then passing to the 
language.  PHP is just a language.   There are some pretty ugly, 
inelegant things going on under the hood with respect to includes under 
ASP - if you want gorey details let me know.  :)

After writing all this I see it's basically a rehash of the 9/2/2001 
posting in the user comments under include at the php manual site.  Is 
there a reason one of those 3 options isn't viable?

Michael Kimsal
http://www.phphelpdesk.com
Taking the ? out of <?php
734-480-9961



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

Reply via email to