|
Cookbook /
SideBarSpecialQuestionHow can I create special SideBars for a single group or page? AnswerTo 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. QuestionIs it possible to automatically append AnswerYes! 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
(: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) ]]
* [[(Cookbook:)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 CommentsWhen I create Groupname.Sidebar it simply does not load THAT sidebar with THAT Groupname. 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 AlsoContributors
|