SETTING VARIABLES

If you make a page ending with .*Dict (see page_dict_regex), you can set some variables to specific values:

var1
value1
var2
value2
var3
value3

The actual format of the variable assignment above when editing in the edit window is the following:

 var1:: value1
 var2:: value2
 var3:: value3

The leading space and the space after '::' are important.

GETTING VARIABLES

At Every Page Refresh

You can use these values using the GetVal macro:

<<GetVal(WikiDict,var1)>> <<GetVal(WikiDict,var2)>> <<GetVal(WikiDict,var3)>>

Renders as:

value1 value2 value3

When Saving the Page

If the variables are set on UserName/MyDict (UserName must of course be replaced as appropriate), you can get the variables when saving any page with @var1@, @var2@, ...etc. instead of the GetVal macro. See HelpOnPageCreation for more information about the @variables@.


CategoryMoinMoinBug - there seems to be some problems:


This seems to be similar to one of the first versions of IncVar that I made (at this page: macro/IncVar). I originally had the same bugs, but by importing "time" at the beginning, that seemed to tell MoinMoin that the data should always be refreshed. Mine seems to be more flexible than this GetVal one. For instance, you can use any page name, doesn't have to be a WikiDict, it has sane defaults for everything also. I think that the only thing that needs work is the error messages generated when you try to get a variable that doesn't exist. Regardless, feel free to merge my code with the GetVal code to get it working. - -- 204.69.158.81 2005-05-18 16:05:39

MoinMoin: WikiDict (last edited 2009-10-20 18:04:22 by p54BD748A)