[pmwiki-users] Shared Pages in Farms

Patrick R. Michaud pmichaud at pobox.com
Wed Feb 14 10:35:44 CST 2007


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:
> >> I'm splitting my site into a small farm, and there are some pages I want 
> >> to share (almost) between wikies.
> >>
> >> The shared pages recipe looks easy enough.
> >>
> >> Can I hide some parts of a page from some wikis by using (:if 
> >> statements? I've already set separate session_name and $WikiTitle in the 
> >> config.php files, if that helps.
> > 
> > Sure, (:if:) directives can be used to suppress parts of the page--
> > the tricky part will be defining the conditionals used.
> > 
> > What criteria are you wanting to use to decide if a particular
> > section is to be shown or suppressed?
> 
> The wiki that they used to reach the page. So folks coming at it from 
> sandy.onebit.ca would see a slightly different version that those coming 
> at it from cricket.onebit.ca.

Ah.  I'd probably do something like:

    $Conditions['sandy'] = ($_SERVER['HTTP_HOST'] == 'sandy.onebit.ca');
    $Conditions['cricket'] = ($_SERVER['HTTP_HOST'] == 'cricket.onebit.ca');

Then you can have (:if:) conditionals like

    (:if sandy:)
    This content is visible only to people accessing sandy.onebit.ca
    (:if cricket:)
    This content is visible to people accessing cricket.onebit.ca
    (:if:)
    Everybody sees this.

A more generic form might be to define a 'server' conditional that
takes a parameter:

    $Conditions['server'] = 'strpos($_SERVER["HTTP_HOST"], $condparm)!==false'

which then allows:

    (:if server sandy:)
    Server name contains 'sandy'
    (:if server cricket:)
    Server name contains 'cricket'
    (:if server xyz:)
    Server name contains 'xyz'
    (:if:)
    Always displayed

Pm



More information about the pmwiki-users mailing list