...
When adding a custom variable, you can see multiple fields: one for the default value, and one per language you’ve enabled in Refined.
Nest default variables within a custom text variable
It’s possible to nest one or more default variables within a custom text variable, for example:
$welcome$ = Welcome to $sitename, $userfirstname!
However, it is not possible to nest custom variables within one another. This means that the following would not work:
$first$ = coffee
$second$ = I like $first$
Note that in the Site Builder you can only use custom text variables that don’t nest any variables at all, or that nest one or more of the following variables:
Variable | Description | Introduced in version |
---|---|---|
$username | The logged-in user’s username. |
|
$userfullname | The logged-in user’s full name. |
|
$userfirstname | The logged-in user’s first name. | 2.0 |
Examples of custom variables
Expand | ||
---|---|---|
| ||
In this example, we translate a category called Help & info. After completing these steps, the category name will automatically be translated anywhere it appears on your site.
|
...
Expand | ||
---|---|---|
| ||
In this example, we add a text to the top of the Search Highlight to inspire visitors to search for help. The entered text will be a combination of text and a text variable.
|
Nest variables
It’s possible to nest one or more default variables within a custom text variable, for example:
$welcome$ = Welcome to $sitename, $userfirstname!
However, it is not possible to nest custom variables within one another. This means that the following would not work:
$first$ = coffee
$second$ = I like $first$
Note that in the Site Builder you can only use custom text variables that don’t nest any variables at all, or that nest one or more of the following variables:
...
Variable
...
Description
...
Introduced in version
...
$username
...
The logged-in user’s username.
...
...
$userfullname
...
The logged-in user’s full name.
...
...
$userfirstname
...
The logged-in user’s first name.
Note: this does not work for names formatted as "lastname, firstname."
...
Scripted text variables
Custom text variables can execute small scripts, which lets you use them to display dynamic values or to add a condition to them. For example, you can create a $greeting$ text variable that says Good morning or Good afternoon depending on the time of day.
...