DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:const

This is an old revision of the document!


Const Plugin

Compatible with DokuWiki

hrun,binky, weatherwax, adora belle

plugin work on wiki pages with constants, self defined variables and make calculations

Last updated on
2015-01-31
Provides
Syntax, Action
Repository
Source

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 fields

Tagged with calculation, constants, math

By lisps

Installation

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

Examples/Usage

<const>
print=Calculation
value1=10
value2=30
value3=%RANDOM%

formular=(value1 * value2) + (value3 / 2)
result:formular
</const>

  * Value 1 = %%value1%%
  * Value 2 = %%value2%%
  * Value 3 = %%value3%%

%%print%% => %%formular%% = %%result%%

Results in:

  • Value 1 = 10
  • Value 2 = 30
  • Value 3 = 30130

Calculation ⇒ (value1 * value2) + (value3 / 2) = 15365

Syntax

  1. define anywhere in your page a <const></const> Block.
  2. with variable=string you can assign a string to the variable. You can also assign a constant to a variable.
  3. with result:formular you can execute a formular and store the result in the result variable. Inside the formular constants and earlier defined variables are allowed.
  4. to display a variable on the page, use % %variable% % (without blank)

Available constants are:

constants description
%ID% pageid noNS(cleanID(getID()))
%NAMESPACE% namespace getNS(cleanID(getID()))
%RANDOM% random number strval(rand())
%USER% username
%YEAR% year date(“Y”)
%MONTH% month date(“m”)
%MONTHNAME% monthname date(“F”)
%WEEK% weeknumber date(“W”)
%DAY% day date(“d”)
%DAYNAME% dayname date(“l”)
%AUTOINDEX% autoinkrement variable

Configuration and Settings

Development

Change Log

  • 2013-10-28
    • Initial release

Known Bugs and Issues

2014-03-18 This plugin works for me. But the section editing does not work anymore. I mean if you have some headlines, you can edit each headline separatly. If you do so, the headline gets corrupted. I think, the culculation of the position of the headline is wrong.
can anyone fix this? Thanx.

Can you try the development version. If this does't help, please open a bug report on github and list your dokuwiki plugins. — lisps 2014/03/19 07:35

ToDo/Wish List

FAQ

Discussion

This plugin doesn't work at all, is buggy and useless. Anyway, what is the reason for this trivial syntax component?

It is not helpful to anyone to write that this plugin is buggy without specifying what the bugs are. Can you please be more specific in order to help the author (and other users) identify any issues?
If you don't see a reason for the plugin you are free to not use it. — Anika Henke 2014/01/26 18:17
To be plain: The “comment” above doesn't work at all, is buggy and useless. Anyway, what is the reason for this trivial blah-blah?
This plugin conflicts with edittable: If const (Development snapshot) is used in a table, we can not edit the table without destroying the contents. — Michael Kohn 2014-11-04 17:43

should be fixed now lisps 2015-01-31

Thanks a lot! It works :-)Michael Kohn 2015-02-04 15:30

Would it be possible to use differently named constants? (Like crosssection_mm or Volume_L instead of value1 and value2) ? This would make the formulars much more easy to read… Anyway, thanks for your great work so far Ocko / 20.03 (?? How can I automaticly sign in DK, like ~~~~ in MW?) Just noticed int works, bu only if you write everythin in small letters, w/o special chars…!

Can we control the decimals somehow?

plugin/const.1426848030.txt.gz · Last modified: 2015-03-20 11:40 by 134.95.200.161

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