Искать  
 
   
 
Плагин: Математические операции (Mathematical operations)
Отправлено: 01 Декабрь 2008 03:43 P.M.   [ Игнорировать ]
Member
Avatar
RankRankRank
Всего сообщений:  154
Зарегистрирован  2008-05-06

Написал небольшой плагин для выполнения основных математических (арифметических) действий (т.е. + - * / )

Может быть особенно полезен при использовании с условными выражениями ({if}).

Плагин принимает два параметра, num1 и num2 - числа, над которыми вы хотите произвести действия

Вызов:

{exp:math:add num1="10" num2="2"

чтобы прибавить 2 к 10 (10+2)

{exp:math:subtract num1="10" num2="2"

чтобы вычесть 2 из 10 (10-2)

{exp:math:multiply num1="10" num2="2"

чтобы умножить 10 на 2 (10*2)

{exp:math:divide num1="10" num2="2"

чтобы разделить 10 на 2 (10/2)

Тред на форуме ЕЕ

Приложения с файлами
pi.math.zip  (Размер файла: 1KB - Загрузок: 607)
 Подпись 

http://www.intoEEtive.com

Профиль
 
 
Отправлено: 01 Февраль 2009 10:04 P.M.   [ Игнорировать ]   [ # 1 ]
Новичок
Avatar
Rank
Всего сообщений:  44
Зарегистрирован  2009-01-19

Респект. Плагин пригодился)

 Подпись 

Мои статьи про EE

Профиль
 
 
Отправлено: 28 Март 2009 02:51 P.M.   [ Игнорировать ]   [ # 2 ]
Администратор
RankRankRankRank
Всего сообщений:  1354
Зарегистрирован  2008-01-02

Laisvunas опубликовал модифицированный плагин -
Plugin: Simple Math

There is already the plugin Mathematical Operations by Yuriy Salimovskiy which has the same purpose. My plugin is more powerful since it

1) allows more mathematical operations;

2) allows to input more than two numbers;

3) allows to control order of mathematical operations by using round brackets.

PARAMETERS

1) calculate - Required. Allows you to input a string consisting of numbers,
symbols of mathematical operations and round brackets, e.g
calculate = “(10 + 5) / 3”. Symbols of supported mathematical operations are:
+ (addition), - (subtraction), * (multiplication), / (division),
% (division remainder), ++ (increment),—(decrement).

2) invalid_input - Optional. Accepts two values: “alert” and “silence”.
Default value is “silence”. If the value is “alert”, then in cases when
the plugin has some problem with parameters,  PHP alert is being shown;
if the value is “silence”, then in cases when the plugin has
some problem with parameters, it finishes its work without any alert being shown.
Set this parameter to “alert” for development, and to “silence” - for deployment.

 Подпись 

booooring…

Профиль