DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:showif

showif Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" no

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 condition, ifauth, ifauthex, isauth, nodisp

Tagged with acl, hide, text

Note

There is un-merged commit to make compatible with 'Hogfather' ⇒ https://github.com/haraldronge/showif/pull/1/commits/08b87900724521883b1ef0848d658a6d7899764e

dcabernel 2021-05-07 18:06

Description

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

The text is still on the page, but not displayed. For true hiding, you would have to use the include plugin and set the appropritate ACLs.

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

Installation

Search and install the plugin using the Extension Manager. 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

For me this plugin is working on 2017-02-19 “Frusterick Manners”. 2017/8/10 ben

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. — 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. — Harald 2014/04/14 13:00

plugin/showif.txt · Last modified: 2021-05-07 18:18 by emtest

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