DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:showif

showif Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" unknown
  • 2015-08-10 "Detritus" unknown
  • 2014-09-29 "Hrun" yes

plugin Shows some text of a page only if a list of conditions is true

Last updated on
2013-10-15
Provides
Syntax
Repository
Source

Similar to ifauth, nodisp

Tagged with acl, hide, text

Description

Shows some text of a page only if a list of conditions is true.
Can hide sections.

Lazy hiding based on plugin nodisp from Myron Turner.
This plugin is particularly useful in open Wikis with closed sections.

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to the latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples/Usage

Example 1:

Show some welcoming text for users of a public page that are not yet logged in.

<showif isloggedin>
You may now explore the rest of the site.
</showif>

<showif isnotloggedin>
Please log in to view the rest of the site.
</showif>

Example 2:

Show a direct upload link if the user may edit:

<showif mayedit>
[[http://[yourwiki]/lib/exe/mediamanager.php?ns=:[yournamespace]:|Upload MP3-files]]  
</showif>

Syntax

Basic syntax:

<showif [condition1], [condition2], ...>[text]</showif>
  • condition can be:
    • isloggedin
    • isnotloggedin
    • mayonlyread
    • mayatleastread
    • mayedit
    • isadmin

Conditions may be a comma-separated list, all conditions have to be true to show [text].
Not all combinations make sense ;-)

Discussion

Known Bugs and Issues

This Plugin dosn't work in the sidebar from the DokuWiki default template.

Any plans to change this? I would be happy because I would need this function. 2014/01/20 cit

No not currently, too much else to do, but I would be happy if somebody else would do it, code is quite simple. — HaraldHarald
harald

2014/01/20 17:44

Tip:

If you want to show and hide headings/sections use showif in combination with the include-plugin! This way you can switch whole pages. — HaraldHarald
harald

2014/04/14 13:00

plugin/showif.txt · Last modified: 2015-09-13 18:00 by Aleksandr