Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Number formatting and Math functions

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
benmann
Smarty n00b


Joined: 29 May 2003
Posts: 1

PostPosted: Thu May 29, 2003 2:51 pm    Post subject: Number formatting and Math functions Reply with quote

Hi There,

Im having a problem with the Math function and getting a numeric value from an array.

I have a database that contains 3 columns of prices for a conference, eg 999.00, 595.00 and 250.00. These values are stored in an array by PHP and assigned to a variable for access in my tpl.

I then take each price to show the tax (VAT) and another to show the total including tax. I use the {Math "x * y"} function for this.

For the 999.00 and 595.00 values this works fine, but for the 250.00 value Smarty seems to think that this is a non-numeric value.

Printing out the value shows it as 25 .00 - Notice the space where the 0 should be. On the web page this looks like 25.00, which is a long way out. This also causes the Math function to fail as it thinks its a string, that can't be cast as a number.

Can anyone help???

Many Thanks

Ben Mann.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP