Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Line: 49 to 49 | ||||||||
You can set variables in all the following places: | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
Settings at higher-numbered levels override settings of the same variable at lower numbered levels, unless the variable was included in the setting of FINALPREFERENCES at a lower-numbered level, in which case it is locked at the value it has at that level. | ||||||||
Line: 89 to 92 | ||||||||
You can also set preferences variables on a topic by clicking the link Edit topic preference settings under More topic actions . Use the same * Set VARIABLENAME = value syntax. Preferences set in this manner are not visible in the topic text, but take effect nevertheless. | ||||||||
Added: | ||||||||
> > |
Controlling User Level Preferences OverrideBy default, user level variables are set at the step 4 as stated in the previous section. That means a user can finalise some preferences variables so that web level or topic level setting cannot override it. This may result in a situation the web or page owner doesn't expect.$TWiki::cfg{DemoteUserPreferences} has been introduced to avoid it.
If it's set to true, user level variables are set at the last step instead of the step 4.
But this is not enough.
To guarantee a certain result, you need to finalise critical preferences variables set at the web or topic level, which is cumbersome.
So preferences variables DENYUSERPREFEENCES and ALLOWUSERPREFEENCES have been introduced.
* Set DENYUSERPREFERENCES = allIf you allow INYMCEPLUGIN_DISABLE and SKIN to be set at the user level:
* Set ALLOWUSERPREFERENCES = TINYMCEPLUGIN_DISABLE, SKINIf you allow user preferences to set anything other than TINYMCEPLUGIN_DISABLE or SKIN :
* Set DENYUSERPREFERENCES = TINYMCEPLUGIN_DISABLE, SKINPlease note DENYUSERPREFEENCES and ALLOWUSERPREFEENCES affect user preferences regardless of $TWiki::cfg{DemoteUserPreferences} .
You can set those variables at the site level while $TWiki::cfg{DemoteUserPreferences} setting to false.
If you do so, you should finalise DENYUSERPREFEENCES and ALLOWUSERPREFEENCES .
Otherwise, they might be overridden by user preferences.
You will get the most benefit of DENYUSERPREFEENCES and ALLOWUSERPREFEENCES by setting $TWiki::cfg{DemoteUserPreferences} to true.
That way, each web can specify how much user level preferences overriding is allowed. | |||||||
Parameterized Variables (Macros)It is possible to pass parameters to TWiki variables. This is called a macro in a programming language. To define a parameterized variable, set a variable that contains other variables, such as:* Set EXAMPLE = Example variable using %DEFAULT%, %PARAM1% and %PARAM2% * Set DEMO = Demo using %DEFAULT{ default="(undefined)" }%, %PARAM1{ default="(undefined)" }% and %PARAM2{ default="(undefined)" }%A special %DEFAULT% variable denotes the default (nameless) parameter of the calling variable. Variables optionally may list a default="..." parameter that gets used in case the calling variable does not specify that parameter.
To use a parameterized variable (or call a macro), add parameters within the curly brackets, such as:
* %EXAMPLE{ "foo" PARAM1="bar" PARAM2="baz" }% * %DEMO{ "demo" PARAM2="parameter 2" }% -- note that PARAM1 is missingwhich resolves to:
ExampleDefine variables:* Set DRINK = red wine * Set FAVORITE = My %DEFAULT{default="favorite"}% dish is %DISH{default="steak"}%, my %DEFAULT{default="favorite"}% drink is %DRINK%. ![]() %DISH{default="steak"}% ), or as a preferences setting (Set DRINK = ... ).
Use Variables:
%FAVORITE{ DISH="Sushi" DRINK="Sake" }%Returns: My favorite dish is Sushi, my favorite drink is Sake. %FAVORITE{}%Returns: My favorite dish is steak, my favorite drink is red wine. %FAVORITE{ "preferred" }%Returns: My preferred dish is steak, my preferred drink is red wine. | ||||||||
Line: 152 to 191 | ||||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < | Search or List Variables by Category | |||||||
> > | Search or List Variables by Category | |||||||
|