[pmwiki-users] Wikigroup - naming (& getting) the indicated homepage

Patrick R. Michaud pmichaud at pobox.com
Wed Jan 3 15:07:15 CST 2007


On Wed, Jan 03, 2007 at 02:56:45PM -0500, Donald Z. Osborn wrote:
>    In a wikigroup config, if I set $Name = 'Something'; and then go to
>    www.althatstuffintheURL/wikigroup , then shouldn't there be an automatic
>    redirect to www.althatstuffintheURL/wikigroup/Something ?

Nope.  PmWiki doesn't load per-group or per-page configurations
until after it's resolved the pagename.  So, by the time the
wikigroup configuration is loaded, PmWiki has already decided
on the correct pagename.

Also, there is no $Name global variable to set (at least, 
PmWiki doesn't use one).  There is the {$Name} page variable,
which returns the name (sans any group) of some page, but 
there's not a corresponding PHP variable.

For what you're wanting to do, I suspect you want to set
the $DefaultName variable, and this should be done relatively
early in the config.php.  If you're wanting to change $DefaultName
only for a particular group, you'll probably need to do something
like...:

    if (preg_match('!^NG-L10n[./]!', $pagename))
      $DefaultName = 'Accueil';

Another option is to simply put a redirect on the HomePage
that goes to the desired page -- i.e., in local/NG-L10n.HomePage.php,
put:

    <?php
      Redirect('NG-L10n.Accueil');

>    Accueil is set as the homepage in the latter. Is it maybe not possible to
>    have something other than HomePage retrieved automatically?

It's possible to change the default page on a site-wide basis,
but there's not really an easy way to do it only for certain 
groups.

Although, come to think of it, another useful possibility would
be to modify PmWiki's page search order, by doing something like:

   $PagePathFmt = array(
      '{$Group}.$1', '$1.$1', '$1.Accueil', '$1.{$DefaultName}');

Then, when PmWiki is given only a partial page name (such as 'NG-L10n'),
it will look for both *.Accueil and *.HomePage and
use whichever one it finds.  Again, this setting won't work
in a per-group customization (because PmWiki has to figure out
the full group and page name in order to know which customizations
to load), so it has to be done in local/config.php.  Ideally it
should be near the very beginning of local/config.php .

Pm




More information about the pmwiki-users mailing list