Re: [SMARTY] problem displaying float

From: Date: Fri, 17 Nov 2006 15:27:19 +0000
Subject: Re: [SMARTY] problem displaying float
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13573@lists.php.net to get a copy of this message
On Fri, Nov 17, 2006 at 02:10:12PM -0000, George Pitcher wrote: [...] > The actual code for this page is long and complex, but the relevant snippet > looks like: > =========================================================== > $fee = [web-service response (in dollars and cents)] > settype($fee, "float"); > $fee_type = gettype($fee); > $range = explode(",",strim($pr)); > $rangecounter = count($range); > $rangecounter = ($rangecounter>1?$rangecounter-1:0); > $ccc_supp = floatval($rangecounter * 3); > settype($ccc_supp, "float"); > $fee2 = $fee + $ccc_supp; > > $smarty->assign('ccc_fee',($rt!='Granted'?'Not available through > CCC: > '.($rt!=''?$rt:'no reason given'):'The CCC QuickPrice for this > request is: > $'.sprintf("%01.2f",$fee2)."<br>$ccc_terms")); > =========================================================== > $pr is a pagerange and in the example is 9-27. extended range might be > 1-3,9-27, which would then add $3 to the $fee variable. > =========================================================== > > If I echo $fee, for my example, I get 160.44. If I echo $fee2, I get 160.00. > But all I've done is add '0' to the $fee variable. this is your third post on the topic and you still refused to show us a single line of template code. now you show us a case where you trigger the error without any smarty interference (I think we can ignore the $smarty->assign() and your error occurs with or without it). so what has this to do with smarty anyway? greetings messju > Cheers > > George

« previous php.smarty.general (#13573) next »