Attention! The RichExchanger exchanger sсript can only be purchased on the richexchanger.com website. Payment via messengers and other websites does not exist.

Plugins
Payment systems
300 140

In many places in the RichExchanger exchange sсript, especially in areas like the rate or reserve fields, you can find the following field:

This is a calculator field with shortcodes.

The top, informational section displays the final result of the entered formula. But only when the page is refreshed.

The main section is a text area for entering the formula itself.

Normal text input

The calculator works like a regular text field. If you enter a numeric value, the result will be the same numeric value:

If you enter the formula value:

1

the result will be:

1

It's simple and easy.

If you enter:

100

the result will be:

100

Math Operations

This form works like a regular, simple calculator. There's nothing complicated about it.

And it supports standard mathematical operations:

+ plus;

- minus;

* multiply;

/ divide.

If you enter the formula:

2 + 2 * 2

the result will be:

6

According to the rules of mathematics, everything is as it should be.

Therefore, you can safely play around with any numbers. For example, the result of the following value:

100 + 20 / 10

will be:

102

Nothing new or unusual.

And the result of the following value:

230 + 1

will be:

231

Easy, right?

Parentheses

According to the rules of mathematics, everything in parentheses is executed first.

If in the example:

2 + 2 * 2

the result will be:

6

because multiplication occurs first, then addition, but with parentheses, things are different.

So in the example:

(2 + 2) * 2

the result will be:

8

because the parentheses are applied first.

Percentage

Sometimes, even very often, we need to add a percentage to something.

For example, we have 100 and need to add 1%.

In a calculator, it would look like this:

100 * 1.01

This works, but it's a bit complicated.

In our calculator, you can enter a value directly as a percentage.

Value:

100 + 1%

We get the result:

101

Easy and simple.

Shortcodes

A shortcode in the calculator works simply as an auto-rеplace.

For example, our shortcode looks like this: [inx_1234], and its value is "1234".

When we enter into the formula:

1 + [inx_1234]

this is interpreted as:

1 + "1234"

and the result is:

1235

A shortcode can have a complex value, for example: [inx_1234], and its value is "+ 1234".

Thus, the formula:

1 + [inx_1234]

is interpreted as:

1 + "+ 1234"

and the result is:

1235

And here's a shortcode: [inx_1234], and its value is "- 1234".

Thus, the formula:

1 + [inx_1234]

is interpreted as:

1 + "- 1234"

and the result is:

-1233

You can also use brackets and other shortcodes in shortcodes.

"Or" sign

The field result must always be a numeric value. Therefore, if the shortcode fails or doesn't exist, 0 will be returned.

For example, the shortcode [indx_1222] doesn't exist.

Then a formula like this:

1 + [indx_1222]

will yield the result:

0

To avoid such situations, there is an "or" operator, entered in the field as two vertical lines.

The formula looks like this:

1 + [indx_1222] || 1 + [indx_1223] || 85

will first look for the first option:

1 + [indx_1222]

If there is no shortcode, it will look for the second option:

1 + [indx_1223]

If there is no such shortcode, it will display the third option:

85

Visual representation

You enter any formula in the text field and can always check the result without saving.

To do this, click the "visual" icon:

All shortcodes

Remembering all the shortcodes is difficult, so there's a shortcode icon:

Clicking it opens a shortcode menu:

Clicking on the name opens the menu, and you'll see the available shortcodes and a search form for that section:

Clicking on the shortcode name or value will transfer the shortcode to the form from which the menu was called.

Video-instruction:
Category: Site management
Back to wiki

We use cookies to improve the functioning of the site and its interaction with users. By continuing to use the site, you consent to the use of cookies (find out more).

You can always disable cookies in your browser settings.