|
Posted by Jonathan N. Little on 06/27/07 13:44
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.
>
What I do is have a DNS server setup for my LAN and set to a private TLD
so all websites have a different domain name whether it is the "live"
version or the locally maintained mirror, e.g.,
live => www.example.com
local => www.example.private.lan
then I have a universal configuration object which in addition to
maintaining client information also configs URL and paths...
in the script I define the local and live server names for each site
define('LOCAL_SERVER', 'www.example.private.lan');
define('REMOTE_SERVER', 'www.example.com');
and upon init of the object a method sets a flag for whether or not the
site is "on web" or not.
....
$this->onweb=($host==REMOTE_SERVER)? 1 : 0;
....
the flag is used to set any differences between local and live server
condition like SSL url and server root, include paths, mailserver
settings, etc.
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
[Back to original message]
|