I need to do deviding:
{math equation="x/y" x=$x y=$y} // $x = '2', $y = '3'
How to convert strings to numbers exactly in Smarty, coz I don't have access to proprietary code of CMS? Thanx!
UPD: Smarty version: 2.6.18
If it's already assigned to a variable, say $var, you can set the type of a variable like this:
{$converted = settype ($var, 'integer')}
You don't have to use the $converted value, but if you don't assign it, the bool will show up in your page.
or you could try
{$variable|intval}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With