DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:fields

fields Plugin

Compatible with DokuWiki

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

plugin Allows storage and retrieval of user-defined fields throughout the page

Last updated on
2021-03-27
Provides
Syntax
Repository
Source

This plugin allows you to define “fields” in a page, which can be used anywhere 1) in the document. This can be very useful to set an author name, a reference string, or a version number for example, and use those variables anywhere in the page.

Download

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

I use Git to manage the source code, which is hosted on Github. You can obtain the development version with this command :

git clone https://github.com/lpaulsen93/dokuwiki-plugin-fields.git

Some interesting links on Git:

If you have any requests (bugs, features, etc.), please use the plugin's tracker, I don't monitor this page.

Usage

To set a field, use the following syntax:

{{fields>FIELD_NAME=FIELD_VALUE}}

where “FIELD_NAME” is the name of the field and “FIELD_VALUE” is the value (obviously :) ). Neither the name nor the value need to be uppercase, in fact they may contain any character. The field value can even contain equal signs (“=”).

To display a field, use the following syntax:

{{fields>FIELD_NAME}}

Note: This plugin supports XHTML rendering as well as ODT rendering.

Usage in ODT rendering

In OpenOffice.org, add a field in this way:

  • Insert → Field → Other → Variable → User Field
  • You can leave the value empty
  • Add this field in your document (usually by clicking on 'insert' in the above window)
  • It's done :-)

Discussion

Feel free to contact me by mail, as I don't monitor this page. If you have any requests (bugs, features, etc.), please use the plugin's tracker.

Issues

Writes directly HTML code

The content of the “fields” seems to be directly output as HTML-Code2), i.e.

  • you cannot use any DokuWiki formatting in field content
  • you can use nearly any HTML directive in field content - from simple font style as italic to :!: Script Code3)

The latter opens the usual question bug or feature: for my purposes in a “super-closed” wiki (only approved users can even read the wiki and not all of them can edit everything) it may be a benefit in some cases while especially in open wikis (anonymous people can edit) it is a security hole - but @Aurélien: please do NOT retract this wonderful tool

hh lohmann 2014/01/10 09:10

If this is true (also haven't checked the code yet), then this should be properly reported and a securityissue be added to the plugin's data. — Anika Henke 2014/01/14 01:37

Fields of Application

(note: the same term “fields” here reveals to be pure coincidence!)

Multiple use of same token

As stated in the main description: If you have the same information at many places, you can maintain (change) it centrally by using a field.

:-P You may also span this over pages by including field definitions via include.

hh lohmann 2014/01/10 09:17

Separation of presentation and content

The fields allow a clear and concise maintenance of data since you can access the fields' content totally apart from its presentation - vice versa you can maintain complex presentation layouts since being not intermingled with data maintenance concerns (see also Separation of presentation and content).

:-P In conjunction with include you can drive this further by applying (via including) a uniform and centrally (and so separately) maintained template to “local” data.

Hint: compare this to dokuwiki.org's uniform plugin description pages via repository

hh lohmann 2014/01/10 09:17

1)
it doesn't appear to work in headings, not in DATA plugin
2)
I have not looked into the plugin's code yet
3)
only HTML based, i.e. Javascript etc. via <SCRIPT>, no PHP or something via <?..?>
plugin/fields.txt · Last modified: 2024-01-04 04:03 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