Difference between revisions of "Smarty 4"
From TMM Wiki
Jump to navigationJump to searchLine 21: | Line 21: | ||
NATS sets the description inside of siteinfo. This displays fine in smarty2 but it will not work too well in smarty4 | NATS sets the description inside of siteinfo. This displays fine in smarty2 but it will not work too well in smarty4 | ||
− | All the math might not work in the template like: | + | <font color="red">All the math might not work in the template like:</font> |
<pre>{$total_profit/100|currency_format:2}</pre> | <pre>{$total_profit/100|currency_format:2}</pre> | ||
− | will need to | + | </br> |
+ | this math logic will need to replaced with a math equation | ||
<pre> | <pre> | ||
{math equation="a/b" a=$total_profit b=100 assign="total_profit_final"} | {math equation="a/b" a=$total_profit b=100 assign="total_profit_final"} | ||
{$total_profit_final|currency_format:2}</pre> | {$total_profit_final|currency_format:2}</pre> |
Revision as of 12:22, 15 November 2022
These changes will be required within any implemented smarty code when upgrading to Smarty 4.
Associative array keys are not automatically assigned as variables and logic like this will no longer work with Smarty4:
$smarty->assign($condition_data);
need to replace with:
if(is_array($condition_data)) { foreach($condition_data as $key => $value) { $smarty->assign($key, $value); //assign the associative array keys as variables in smarty, except periods } }
{html_radios} function works for smarty2, however it does not work too well in Smarty4.
For example:
NATS sets the description inside of siteinfo. This displays fine in smarty2 but it will not work too well in smarty4
All the math might not work in the template like:
{$total_profit/100|currency_format:2}
this math logic will need to replaced with a math equation
{math equation="a/b" a=$total_profit b=100 assign="total_profit_final"} {$total_profit_final|currency_format:2}