|
Posted by Disco Octopus on 06/27/07 09:51
dorayme wrote:
> For almost all of the sites I maintain, I am decking them out
> with PHP includes, some are operating fine outside on external
> servers. There is no management problem for this majority because
> of the portability of the construction I am using:
>
> ($_SERVER['DOCUMENT_ROOT'].'/site/includes/section.inc'); ?>
>
> Works beaut on both external and my local apache Mac server.
>
> But, now that I have the solution to a global construction for a
> Windows server for a couple of my sites (courtesy of help here in
> a recent thread), I am going to have a slight management problem.
> Because the construction used for these servers is double dutch
> to my Mac server.
>
> <? include "e:\inetpub\abc12345\includes\section.inc"; ?>
>
> my solution so far is to put both constructions of the includes
> on the files with one of them commented out for use here on my
> server (for testing) and the other commented out for upload to
> the actual server delivering the company site to the internet.
> This is obviously easy to do for just a few files. And for the
> business of uploading the newly "decked out with includes" whole
> site, I guess I can just use S&R (on the whole site) to switch it
> back and forth.
>
> Anyone got any better idea of how to do this? It's surely not
> that bad what I propose but I have this instinct that there are
> likely smarter way of proceeding.
>
Hi,
In your php.ini file, or you .htaccess file, or your httpd.conf file,
you have a include setting...
This would be unique to the server. So you only really need to enter
your include like this....
<? include "section.inc"; ?>
You should look into the "include_path" setting in php.
*or*, you could do something like this.... (but then, you may need to
include this chunk of code into its own included thing???)
<?php
$GLocalDev1 = 'l-mylocallinuxserver.com';
$GLocalDev2 = 'l-mylocalmacserver.com';
$GLocalDev3 = 'l-mylocalpcserver.com';
$GLive = 'live-site.example.com.au';
if ($_SERVER['HTTP_HOST'] == $GLocalDev1){
$IncludePath = "e:/inetpub/abc12345/includes/";
}
elseif ($_SERVER['HTTP_HOST'] == $GLocalDev2){
$IncludePath = "/home/www/mywebsite/includes/";
}
elseif ($_SERVER['HTTP_HOST'] == $GLocalDev3){
$IncludePath = "/whatever/your/mac/path/is/includes/";
}
include $IncludePath . "section.inc";
?>
--
Disco Octopus
www.choicebeefjerky.com.au
[Back to original message]
|