Difference between revisions of "System Variables"
Line 24: | Line 24: | ||
For example, if on a [[Web Page View]] you have a button that you want to have a different value based on the [[Language|langid]] of the user. | For example, if on a [[Web Page View]] you have a button that you want to have a different value based on the [[Language|langid]] of the user. | ||
− | * Create 2 [[System | + | * Create 2 [[System Variable]]s with |
+ | ::* Name: '''Open1''' Value: '''Open''' | ||
+ | ::* Name: '''Open2''' Value: '''Ouvert''' | ||
+ | And refer to them on the [[Web Page View]] as follows | ||
+ | <pre> | ||
+ | <input type=button value="@system2.Open@me.langid@@" onclick="doThis()"> | ||
+ | </pre> | ||
Revision as of 11:25, 27 September 2012
The System Variables setting on the Global Settings page allows you to create and edit system-wide Custom Fields within your instance. These variables can be referred to from anywhere within SmartSimple using the following syntax:
@system.variable name@
Example:
If you have created a System Variable named Tax Rate you would use:
@system.tax rate@
A global System Library can be accessed as system variables. The available values and functions can be found under System Variables on the Global Settings page. The syntax is:
@system.library.variable name@
Example:
To return a list of languages from the global library, you would use:
@system.library.language@
System 2
You can also pre-process the variable name to access different system variables based on the context.
For example, if on a Web Page View you have a button that you want to have a different value based on the langid of the user.
- Create 2 System Variables with
- Name: Open1 Value: Open
- Name: Open2 Value: Ouvert
And refer to them on the Web Page View as follows
<input type=button value="@system2.Open@me.langid@@" onclick="doThis()">