SideBarSpecial

Question

How can I create special SideBars for a single group or page?

Answer

To replace the standard SideBar for a single group, create a new page entitled GROUPNAME.SideBar. This will then be used in place of the standard SideBar for all pages in the Group GROUPNAME.

The default template pmwiki.tmpl does not automatically support single page SideBars, but any template file can be changed relatively easily to allow it. Edit the page template and change the line

    <!--wiki:$Group.SideBar $SiteGroup.SideBar-->

to

    <!--wiki:$Group.$Name-SideBar $Group.SideBar $SiteGroup.SideBar-->

For GROUPNAME.SomePage, this will use the first of GROUPNAME.SomePage-SideBar, GROUPNAME.SideBar, and Site.SideBar.

Question

Is it possible to automatically append Site.SideBarAdmin (containing commonly used admin-links) to the bottom of every Group.SideBar when viewing the group as admin?

Answer

Yes! Simply modify the skin .tmpl file by changing the following line:

<!--wiki:{$SideBar} $Group.SideBar $SiteGroup.SideBar-->

to

<!--wiki:{$SideBar} $Group.SideBar $SiteGroup.SideBar-->
<!--wiki:$SiteGroup.SideBarAdmin-->

Then, create Site.SideBarAdmin and place in it any links you'd care to see when ever logged in as admin. Here's an example:

(:if auth admin:)
%comment%INCLUDE THIS AT THE BOTTOM OF SIDEBAR WHEN LOGGED IN AS ADMIN%%

. . .

[-edit SideBars:\\
[[{*$Group}.SideBar?action=edit | group SideBar]] | \
[[Site.SideBar?action=edit | site SideBar]] | \
[[(Site.)SideBarAdmin(?action=edit)]]-]

[[Site/WikiSandbox(?action=edit)]]

%sidehead% [[Site/Site]]
(:pagelist group=Site fmt=Site.SideBarAdmin#edit:)

%sidehead% Templates
(:pagelist group=Templates fmt=Site.SideBarAdmin#edit:)

%sidehead% FoxNotifyLists
(:pagelist group=FoxNotifyLists fmt=Site.SideBarAdmin#edit:)

%sidehead% [[http://www.pmwiki.org | pmwiki.org ]]
* [[Cookbook:CookbookBasics | Cookbook (addons) ]]
* [[(Skins:)Skins]]
* [[(PmWiki:)Mailing Lists]]
* [[(PITS:)PITS]]

[-current: {$Version}-]

(:if false:)
## lists Name with ?action=edit
[[#edit]]
* [[({=$Group}/){=$Name}(?action=edit)]]
[[#editend]]
(:ifend:)

thanks to HansB for this solution (mailing list post, with one more alternative solution).

overtones99 October 06, 2009, at 04:18 AM

Notes and Comments

When I create Groupname.Sidebar it simply does not load THAT sidebar with THAT Groupname.
What does one do if one has 1 Sidebar per each Groupname that one wants to see loaded for the Groupname pages alone?
The hints above do not work for this (at least not as they are described here)
Julius Thyssen August 19, 2006, at 05:24 AM

Are you sure you got the Capitalisation right, i.e use MyGroup.SideBar and not MyGroup.Sidebar. so you need for instance Group1.SideBar for Group1 pages, Group2.SideBar for Group2 pages etc. ~HansB


To have a custom sidebar when editing a page one could also add $Action.SideBar as follows:

    <!--wiki:$Action.SideBar $Group.$Name-SideBar $Group.SideBar $SiteGroup.SideBar-->

Then manually create a file in wiki.d named Edit.SideBar which includes some basic instructions for editing (which have been removed from the edit form). $Action.SideBar should be listed first. That way if your action is 'viewing' (the default) or 'history' (diff), PmWiki will move on to the next possable sidebar on the list, unless say Diff.SideBar exits.

The only posable problem I see is that you now have a 'Edit' group. If you are uncomfortable with this, perhaps Site.$Action-SideBar or even $Group.$Action-SideBar would suit your needs.

Waylan Limberg, 2005-Sep-1


See Also

Contributors