0
Follow
0
View

How to solve the problem of #else#?

cwk73914 注册会员
2023-02-27 11:09

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > this code seems to be the Smarty template engine syntax, which contains the terms of a judgment, and an output statement.

If you want to subtract the fixed number 3 directly from the output statement, you can use the mathematical calculation symbol "-" in the output statement, for example:

{#if $refrundstate ==1 && $refrundamount =="0.00"#}0{#else#}{#$staticmoney['business']-3|string_format:"%.2f"#}{#/if#}

In this modified code, We will be the original output statements {# $staticmoney [' business '] | string_format: "%. 2 f #}" modify to {# $staticmoney [' business '] - 3 | string_format: "%. 2 f #}", In this new output statement, we've subtracted the number 3 directly from $staticmoney['business'] and formatted it with string_format, leaving two decimal places.

qq328170374 注册会员
2023-02-27 11:09

This answer quotes ChatGPT

This code is the syntax of a template engine, and may need to be combined with the use of the template engine and related data to fully understand its meaning. However, if you want to directly subtract the fixed number 3 from the result of this code, you can do so by adding a mathematical operator to the code, as follows:

¥{#if $refrundstate ==1 && $refrundamount =="0.00"#}0{#else#}{#($staticmoney['business'] - 3)|string_format:"%.2f"#}{#/if#}


In the code above, we've subtracted 3 from the value of $staticmoney['business'], using parentheses to group this math operation with the subsequent string_format. Finally, the output of the code is formatted in string_format, leaving 2 decimal places.

ahsatx 注册会员
2023-02-27 11:09
< !- - - - - >
duyuan0516 注册会员
2023-02-27 11:09

$staticmoney['business']-3 or(parseInt($staticmoney['business'])-3)

dailiben 注册会员
2023-02-27 11:09

Let's start with the code you gave us. This code is a statement from the Smarty template engine that prints the amount in the template. According to the logic in the code, if $refrundstate is equal to 1 and $refrundamount is equal to "0.00", then 0 is printed; Otherwise output $staticmoney['business'], which should be a floating-point number.
Then, by subtracting 3 from the output, you can wrap a Smarty mathematical operator around the output, like this :

{$staticmoney['business'] - 3}


This allows you to subtract 3 directly from the output.
Note that if $staticmoney['business'] is itself "0.00", then subtracting 3 will still output a negative number, and you may need to add some extra logic to avoid this.

About the Author

Question Info

Publish Time
2023-02-27 11:09
Update Time
2023-02-27 11:09