[pmwiki-users] noleft in SiteHeader suppresses leftbar except for page-actions (mostly)

Petko Yotov 5ko at 5ko.fr
Sat Sep 7 16:51:30 CDT 2013

michael paulukonis writes:
> If I put SetTmplDisplay('PageLeftFmt', 0) in config or the skin, it ALWAYS  
> surpresses the left-content.

And it can be overridden in a local/Group.php or local/Group.Page.php file  
with SetTmplDisplay('PageLeftFmt', 1);

> I would like it to be suppressed when the (:noleft:) markup is present on the  
> page, or in the header.
> Now, SiteHeader would suggest it is almost always present, but I want to be  
> able to turn it off by wiki-editing the appropriate content.
> Is there a way to get a Header (Group or Site) enabled for edit, diff,  
> history, login, etc?

These actions are processed differently than the 'browse' action.

I won't say that this is good or bad, I'll just explain what happens and why  
it is not easy to do what you want with a directive in a page.

With "browse" first the page content (including GroupHeader) is converted to  
HTML, then the skin is rendered section by section -- for example the  
SideBar and PageActions pages are included in the skin so they are rendered  
later than the page text.

The (:noleft:), (:noheader:), (:nofooter:) and other directives set or  
change variables used by the skin, but need to be set before the concerned  
skin section is rendered. For example, anything in the page text and in  
GroupHeader/footer can set a variable and it will be respected. Other  
example, in a SideBar, setting (:noleft:), (:noaction:) or (:noheader:) will  
have no effect (these sections are rendered before the SideBar is rendered)  
but (:nofooter:) will have effect (the skin footer is rendered after the  

With the actions edit, diff, login, search, the page text is not rendered to  
HTML, only a function is registered to be called later by the skin: you can  
check the variables $HandleSearchFmt, $HandleEditFmt,$HandleDiffFmt,  
$AuthPromptFmt (some of them are redefined in forms.php).

So for example when the skin comes to render the diff function, the SideBar  
has already been rendered and setting a (:noleft:) directive in the  
$HandleDiffFmt will have no effect on the SideBar.

So, in order to set the directives before the skin sections are processed,  
you can set in config.php something like:

  $HandleEditFmt = array('function:UseGroupHeader', &$PageStartFmt,
    &$PageEditFmt, &$PageEndFmt);

we insert 'function:UseGroupHeader' before the default settings and then we  
add this function:

  function UseGroupHeader($pagename) {
    global $GroupHeaderFmt;
    $x = MarkupToHTML($pagename, $GroupHeaderFmt);
    return ''; # returns nothing

This way, when PmWiki renders the page edit form, the SiteHeader is  
processed before other sections of the skin and can set some variables. But  
this function returns nothing, because it is before even the <!DOCTYPE...>  
start of the HTML page is printed.

If you have more than (:noleft:) in the SiteHeader, you need to define it  
twice in $HandleEditFmt :

  $HandleEditFmt = array('function:UseGroupHeader', &$PageStartFmt, 
    "markup:$GroupHeaderFmt", &$PageEditFmt, &$PageEndFmt);

here we also added "markup:$GroupHeaderFmt" before &$PageEditFmt. Note that  
$GroupHeaderFmt must be defined before $HandleEditFmt in config.php.

The same way you can redefine the other $Handle*Fmt arrays.


> On Thu, Sep 5, 2013 at 3:24 PM, Petko Yotov <<URL:mailto: 
> 5ko at 5ko.fr>5ko at 5ko.fr> wrote:
>    The GroupHeader mecanism (include specific pages before or after the  
>    current page) is only enabled for the actions "browse" (view), "print" and  
>    "preview" for the current page.
>    If you want to apply the (:noleft:) directive to all actions on most  
>    groups, use this in local/config.php:
>     SetTmplDisplay('PageLeftFmt', 0);
>    To enable it in specific groups, just use in the local/Group.php file:
>     SetTmplDisplay('PageLeftFmt', 1);
>    Or, you can also use a different skin.
>    Petko
>    michael paulukonis writes:
>      I've implemented the AllGroupHeader recipe, with the option of using the  
>      GroupHeader if present, or the SiteHeader otherwise.
>      I've added a (:noleft:) directive to the SiteHeader, which eliminates  
>      the leftbar in almost all cases.
>      In the few instances where a GroupHeader exists, I have added (:noleft:)  
>      to the GroupHeader.
>      The few cases where the leftbar re-appears are when page-actions are  
>      performed -- Search (results only), History, Login and Edit.
>      Curiously, the leftbar disappears again if "preview" is selected during  
>      edit.
>      Why is the leftbar re-appearing?
>      Is it something I've set in my theme that I've forgotten about, some  
>      directive I'm missing, some part of core markup that I'm overlooking?
>    _______________________________________________
>    pmwiki-users mailing list
>    <URL:mailto:pmwiki-users at pmichaud.com>pmwiki-users at pmichaud.com
>    <URL:http://www.pmichaud.com/mailman/listinfo/pmwiki- 
>    users>http://www.pmichaud.com/mailman/listinfo/pmwiki-users

More information about the pmwiki-users mailing list