As i am new to smarty, I am not at able to convert floating number to int. Ex: 12.234 => 12 please help me if u find any solution
Why don't you cast it before attaching it to the view. There is no reason to pass the view data that needs to be further processed.
$int = (int) $float;
$smarty->assign(array(
'number' = $int
));
If you really must get the integer portion of a float using Smarty, try this...
{$number|string_format:"%d"}
That is like PHP's printf()
.
Also you should be able doing this: {$variable|intval}
this might work give a try
(string)((int)$float)
that too check this link
http://www.smarty.net/forums/viewtopic.php?p=61912
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