[pmwiki-users] Shared Pages in Farms
Patrick R. Michaud
pmichaud at pobox.com
Wed Feb 14 12:01:48 CST 2007
On Wed, Feb 14, 2007 at 12:06:05PM -0500, Sandy wrote:
>
>
>
> Patrick R. Michaud wrote:
> > On Wed, Feb 14, 2007 at 11:14:03AM -0500, Sandy wrote:
> >> Patrick R. Michaud wrote:
> >>> On Wed, Feb 14, 2007 at 10:29:33AM -0500, Sandy wrote:
> >>>So folks coming at it from sandy.onebit.ca would see a slightly
> different version that those coming
> >> at it from cricket.onebit.ca.
>
> Looked simple enough, but it didn't work.
>
> http://www.sandy.onebit.ca/Test/Whichwiki
>
> Haven't gotten around to shared.d yet, but I it should still work, right?
>
> > $Conditions['sandy'] = ($_SERVER['HTTP_HOST'] == 'sandy.onebit.ca');
> > $Conditions['cricket'] = ($_SERVER['HTTP_HOST'] == 'cricket.onebit.ca');
Oh. The code I gave does an exact match for "sandy.onebit.ca"
and "cricket.onebit.ca", but the url has "www.sandy.onebit.ca".
So, I guess we need to be a bit more liberal in checking for
the host name:
## (:if sandy:) is true when hostname contains "sandy"
$Conditions['sandy'] = (strpos('sandy', $_SERVER['HTTP_HOST']) !== false);
## (:if cricket:) is true when hostname ends with "cricket.onebit.ca"
$Conditions['cricket'] = (strpos('cricket', $_SERVER['HTTP_HOST']) !== false);
Note that these are fairly liberal checks -- in particular,
if you ever have a host named "www.yesandyes.onebit.ca" then
(:if sandy:) would be treated as "true" because the hostname contains
the sequence "sandy" in it. But if we get to that point it's
easy enough to write a more sophisticated test that would handle
such cases.
Pm
More information about the pmwiki-users
mailing list