Table of Contents
SidebarNG Plugin
Compatible with DokuWiki
Lemming
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
Similar to sidebar
Installation
Download the archive and unpack it into <dokuwiki>/lib/plugins
.
- .zip Plugin Manager
The plugin can also be installed via git.
% cd <dokuwiki>/lib/plugins % git clone git://github.com/chimeric/dokuwiki-plugin-sidebarng.git sidebarng
New Development Version
Hello, I created a new repository with updates from arctic and dokubook template and some more config options.
Configuration
The plugin can be configured using DokuWiki's configuration manager available in the admin menu.
pos | sidebar position |
pagename | wiki pagename to use for sidebars (default “sidebar”) |
group_ns | Namespace for group sidebars (default “group”) |
user_ns | Namespace for user sidebars (default “user”) |
content | Sidebar content |
order | Sidebar order (comma separated) |
main_always | Always show main sidebar (default yes) |
Sidebar Types
These are the different sidebar types.
Type | Description |
---|---|
main | see main sidebar |
user | see user sidebar |
group | see group sidebar |
namespace | see namespace sidebar |
trace | shows the trace |
toolbox | shows the set of “action links” (login, edit, index, etc.) inside the sidebar, instead of their default location in horizontal toolbars above and below the page |
extra | You can put a file inside <dokuwiki>/lib/plugins/sidebarng/ called sidebar.html which will be included if you select the extra type. This comes in handy for example if you like to include Google ads. |
custom | see custom sidebar |
ACL Setup
If you like to use the user- or group-sidebars you have to set up your <dokuwiki>/conf/acl.auth.php
the right way.
This is an example setup for a user “tom” (User-Name: tom) who is a member of group “@user”. The “user sidebar namespace” is set to “user
” and “group sidebar namespace” is set to “group
”. We will grant him write/page-creation/upload permissions for his own namespace and read/edit permissions for the group:users
namespace to everyone who's part of the group “@users”.
---- snip ---- user:* @ALL 0 group:* @ALL 0 user:tom:* tom 8 group:users:* @user 2 ---- snap ----
First Steps
Adding the Main Sidebar
First of all, you would probably like to create the main sidebar, i.e. the sidebar associated with the root namespace. You simply have to create a wikipage called sidebar
—or whatever you set pagename
to— and add some links.
====== Navigation ====== [[wiki:playground]]\\ [[wiki:syntax]]\\ [[some:more:links]]\\
Tip: It is possible to create this page right in the wiki. Go to any page of your wiki and change the query string of the URL (in your browser's address bar) to '?id=sidebar'; then just create this page.
Adding a User Sidebar
If you've enabled user sidebars
you can add a sidebar for each registered user. All you have to do is create a wikipage user:username:sidebar
. Note, this feature depends on a proper acl-setup. If you use @USER@
inside this sidebar it will get substituted with the user name of the logged in user.
Adding a Group Sidebar
Group sidebars are set up just like user sidebars. For example, to create a sidebar visible only to those in the admin group, you would create one named group:admin:sidebar. If you use @GROUP@
inside such a sidebar it will get substituted with the group name of the sidebar.
Adding a Namespace Sidebar
If you've enabled namespace sidebars you can add a sidebar for every namespace you like. Thus the naming scheme is the same for all sidebars, the only thing you've to do is create a page called, you guessed right , “sidebar” inside the desired namespace. This sidebar, then, will only show if you browse pages within this namespace.
Adding custom sidebars
The plugin also supports custom sidebars. You can create your own custom sidebar by creating a new subdirectory inside <dokuwiki>/lib/plugins/sidebarng/sidebars/
and putting a file called sidebar.php
in there which holds your PHP code, i.e. <dokuwiki>/lib/plugins/sidebarng/sidebars/<sidebar name>/sidebar.php
. Then you can activate the sidebar by adding its name to the comma separated list of other sidebars in the sidebarng settings. For an example have a look at <dokuwiki>/lib/plugins/sidebarng/sidebars/example/sidebar.php
.
Bugs / Feature Requests
Please report bugs or feature requests at the Bug tracker.
Further Resources
Changes
- release preparations (2010-06-04 09:28)
- fixed acl check closes #7 (2010-06-04 09:26)
- release preparations (2010-05-31 17:05)
- show @ALL group sidebar for non logged in users closes #3 (2010-05-31 17:01)
- release preparations (2010-01-26 15:13)
- fixed stupid output buffering bug (2010-01-26 15:13)
- release preparations (2010-01-08 13:46)
- if not main_always and no sidebars exists don't display sidebar, clos… (2010-01-07 14:45)
FAQ
It doesn't seem to work, the sidebars appear at the wrong place, what can I do?
That's most probably a caching issue - try CTRL+SHIFT+R in Firefox.
Change text alignment
Change the style.css in the plugin-folder. You'll need to empty the caches, otherwise the change will not show immediately.
Discussion
NOTE: Don't post patches, bug reports or feature requests here. Use the Bug Tracker instead. I visit this page not on a regular basis. — chi 2010/01/08 13:47
I believe that a couple of screenshots will be useful here. mirari
mirari, I'm a user who didn't make screenshots, but I do use this plugin here. I made some minor changes, like removing some CSS clear
directive that'd prevent the main page from aligning to the right of the sidebar.
I use this plugin in conjunction with nstoc.
It works for the mainpage but not for having different tocs according to namespaces. isma
Finally, it works, not needing to add the namespaces' names !!!
Yes, there is a definite problem with the clear:both tag in sidebarng/style.css. Just remove it for “div.right_sidebar div.sidebar_box”. At least when viewing in Chrome.
Non-Printing Sidebar
I didn't want the sidebar content showing up when users printed the page. To accomplish that, I added a print.css stylesheet to the dokuwiki\lib\plugins\sidebarng folder. Here is it's content:
div.dokuwiki div.left_sidebar { display: none; } div.dokuwiki div.right_sidebar { display: none; }
Here is the code if you want to keep a fixed header, foot, sidebar and toc
div.dokuwiki div.stylehead { position:fixed; top:0; left:0; width:100%; height:90px; background-color:#FFFFFF; overflow:hidden; z-index:100; } div.dokuwiki div.stylefoot { position:fixed; bottom:0; left:0; width:100%; height:50px; background-color:#FFFFFF; overflow:hidden; } div.dokuwiki div.left_sidebar { position:fixed; top:100px; left:0; width:200px; height:100%; overflow:auto; padding:5px; border-right: 1px solid __border__; } div.dokuwiki div.page_right { height:100%; overflow:auto; margin:90px 5px 50px 200px; display:block; } div.dokuwiki div.sidebar_box ul { margin-left: 1.2em; } div.dokuwiki div.page_right div.toc { position: fixed; right: 5px; top: 60px; z-index:200; } .anchor { padding-top: 90px; } div.dokuwiki div.page_right div.toc a { padding-top: 0; } //this is to hide the small inc button div.footerinc { display:none; } //this is to hide the edit button in the sidebar div.dokuwiki div.left_sidebar form { display:none; }
Note about the class .anchor. This is to fix the problem of named anchor under the header. So to make it work, you have to change the inc/parser/xhtml.php Before
$this->doc .= '><a name="'.$hid.'" id="'.$hid.'">';
After
$this->doc .= '><a class="anchor" name="'.$hid.'" id="'.$hid.'">';