DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:sidebar

sidebar Plugin

Compatible with DokuWiki

2009-02-14+

plugin Based on sidebar template by ChrisS but works as a plugin with any template

Last updated on
2009-06-05
Provides
Action
Conflicts with
discussion, noprint

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 displaywikipage, sidebarng

Tagged with sidebar, template

Based on Sidebar template by ChrisS.

:!: After installation, you have to enable the sidebar via the Configuration Manager. Make sure to disable the original sidebar template or switch to the default template before enabling this plugin.

How it works

The plugin registers a hook after the TPL_ACT_RENDER event, which is fired after the main content of the page is rendered. It then adds a CSS class to the page BODY using JavaScript and also outputs the sidebar contents.

It works exactly like the Sidebar template by ChrisS but as a plugin and with (hopefully) any template.

Template Compatibility

Please list the templates you've tested this plugin with and note down problems or issues.

Template Works? Problems
default X
sidebar X have to disable the template-sidebar

Major Problems

  • For me, this plugin does not work at all. I changed template to default and deleted sidebar template (which worked just fine). I also have disabled all other plugins, yet the screen turns all white, and nothing shows up in source code, no matter what page I go to. I have to manually delete sidebar plugin to have it work.
    —Marcus
    • You might have to delete the DokuWiki cache (e.g. using cacherevisionseraser). As long as the plugin is correctly loaded, there MUST be some <div id=“sidebar”> in the page source.
  • I find the same behaviour as Marcus. Even with a freshly unpacked DokuWiki distribution (2009-02-14), with empty cache, putting the sidebar directory in lib/plugins gives a white screen.
    —Garrelt
    • I just tried it on my local webserver with the latest DW version: unpacked, ran install.php, downloaded plugin via Plugin Manager, enabled plugin … and everything works fine. Do you use a special language or page encoding? Is there anything in the error log? —mARKUS
    • I unpack DokuWiki, run install.php, untar the sidebar.tar.gz file in lib/plugins (Plugin Manager does not seem to work for me due to permission problems), and after that every access to a page (configuration manager, start page, etc…) gives a blank screen. The Firefox error log seems to be empty – Garrelt
      • please look into the Apache/PHP error log for error messages —mARKUS
      • got same problem, Apache error.log: PHP error undefined function tpl_getFavicon() in ../tpl/sidebar/main.php line 34 —Matze
  • 'protected static $done = false;' (action.php line 14) made some trouble here. Workaround: change it into 'var $done = false;', and every 'self::$done' into '$this→done'
    —Fschueller
    • this is because my code is for PHP5, your changes look like PHP4 —mARKUS
  • I just installed it and it works fine but the edit button for the sidebar does not show up even if I'm logged in and have the option on in the config settings.
    —Mike
    • I get the same thing, and there's some design issues (even with the default template). — Minishlink
    • [Fixed] Well, we just need to create the page before… — Minishlink
  • Has anyone been able to make this work along with the discussion plugin? — Ham (2009-06-15)
    • Ham: I seem to have the same bug. See my note under the discussion plugin. — Thanks, Kingsley (2009-06-17)
  • Please have a look at this bug, since the sidebar plugin affects the refnotes plugin: http://code.google.com/p/dwp-forge/issues/detail?id=6
  • Using citation 1) I recognized, that obviously the same stylesheet (of the main page) is used for showing the citation-text while MouseOver. This results in partly invisibility of the citation/popup, because the first column is blank (sidebar) and the border/size of the main window is ignored. While the citations at the end of the line is not visible, you see nothing of the text. DokuWiki 2009-02-14 & latest plugin sidebar
  • You render a div with id #sidebartop, even if breadcrumbs are disabled, causing a gray bar to overlap the title.
  • The sidebar displays even when access to the whole wiki is restricted and the user hasn't logged in. Is there a way to change the contents of the sidebar for locked pages?

Troubleshooting

  • If after enabling the plugin, the sidebar displays on the bottom of the page, you probably need to clear your cache (usually Ctrl+F5 on most browsers).

Feature Requests

  • Can we have some way of setting the width of the sidebar?
  • You/we/I can't really test template compatibility if the goal/functioning of the plugin is just vaguely clear,

p.s. seems to work with my on-going hack of minimal template (with work I mean: something is displayed)

  • the sidebar is injected after the TPL_ACT_RENDER event, which should be after the main content output, see tpl_act_render
  • can the trace be displayed above the content area (above both sidebar and page area, rather than just above page area)?
  • It would be nice if the sidebar respected the useheading setting like the hierarchical navigation path (“youarehere”) does, i.e. if useheading is set, the sidebar should display the Text of the first heading of the entry page in the namespace, …:<ns>:start(.txt) or …:<ns>(.txt). Now if I set useheading, the sidebar displays the heading on pages and the namespace name on namespaces.
  • Is it possible to install a config-switch (checkOnOff) to open the namespace start-page by clicking on the sidebar-navigation entry of the namespace. Instead of listing “start” in the sidebar. The name of the “start”-page is a config-data of dokuwiki, where the name can be achieved, if it is changed by the admin. Like plugin indexmenu. — Ludwig 28.12.2009

Programming Recommendations

Hi just a couple of remarks:

  • Never use tpl_content() to display a wikipage, you will trigger als sorts of events again and enter a recursion (you omit that in your plugin, but this also keeps, under certain circumstances other plugins which use the same event from being executet at all!) … instead use p_wiki_xhtml($ID) which can be found in inc/parserutils.php. p_wiki_xhtml($ID) will handle the permissions automatically for you, so you don't have to check anymore if you should display the edit button or not, it will be displayed if the user has sufficient rights.
  • Don't output <style> tags in the XHTML body, it's not valid. Instead put your CSS in a file named style.css respectively print.css inside the plugin directory. DokuWiki will automatically add it into the CSS it uses (this makes your plugin also work if javascript is disabled ;-)).
  • Same goes for the Javascript. As with the CSS, you can put the JS you need in a file named script.js and DokuWiki will use it automatically.
  • It would probably be better to use TPL_CONTENT_DISPLAY and append the sidebar to the XHTML instead of TPL_ACT_RENDER, that way you won't have to worry about open/closed divs.

HTH — Michael Klier 2009/08/20 15:46

1)
remark
plugin/sidebar.txt · Last modified: 2023-12-16 22:54 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki