[pmwiki-users] wikiforms and related pages link
    Patrick R. Michaud 
    pmichaud at pobox.com
       
    Wed Apr  5 08:00:41 CDT 2006
    
    
  
On Wed, Apr 05, 2006 at 02:52:44PM +0200, noskule wrote:
> noskule schrieb:
> but something is strange: if I do this:
> 
> local/config.php
> 
>    $skin = 'skin'
>    $GroupHeaderFmt = '';
>    $GroupFooterFmt = '';
>    include wikiforms.php
The two assignments remove PmWiki's defaults for $GroupHeaderFmt
and $GroupFooterFmt, and then wikiforms.php just adds its code
to that.
> skins.php
> 
> $GLOBALS['GroupHeaderFmt'] = '';
> $GLOBALS['GroupFooterFmt'] = '';
> 
> local/config.php
> 
>   $skin = 'skin'
>   include wikiforms.php
> 
> it dont works. Does someone have an idea why is that? 
Here, the skin gets loaded *after* the wikiforms.php code.
So, the wikiforms.php code adds its stuff to the default
$GroupHeaderFmt and $GroupFooterFmt, and then the skin.php
file erases it all.
> I would like to have 
> the header config in skins.php cause I dont wont to touch config php for 
> installing the skin . .
1.  Wikiforms.php needs to be loaded after the skin, or as part of
    the skin (after setting $GroupHeaderFmt, $GroupFooterFmt).
or
2.  Instead of clearing $GroupHeaderFmt and $GroupFooterFmt entirely,
    just get rid of the parts that you don't want:
    global $GroupHeaderFmt, $GroupFooterFmt;
    $GroupHeaderFmt = 
      preg_replace('/(:include \\{\\$Group\\}\\.GroupHeader.*?:\\)/', '',
                   $GroupHeaderFmt);
    $GroupFooterFmt = 
      preg_replace('/(:include \\{\\$Group\\}\\.GroupFooter.*?:\\)/', '',
                   $GroupFooterFmt);
Of course, this won't get rid of the GroupHeader/GroupFooter if the
admin or a recipe has changed it to something else, but arguably the
skin shouldn't be overriding an admin's preference anyway.  :-)
Pm
    
    
More information about the pmwiki-users
mailing list