You are here: Re: smarty « PHP Programming Language « IT news, forums, messages
Re: smarty

Posted by Rami Elomaa on 04/02/07 10:33

Man-wai Chang kirjoitti:
>
> in the php:
>
> $total=0.00;
> for (...) {
> $total=$total+round(....,2);
> }
> $theclass = new Template();
> $theclass->assign('po_total', $total);
>
> in the template:
>
> <td width="8%" class="textbox1"><input readonly class="textbox1"
> type="textbox" name="txtPoTotal" id="txtPoTotal" align="right"
> value={$po_total|string_format:"%2.f"} maxlength=10 size=10>
>
> The webpage shows "15.000000", rather than "15.00".

I'm guessing it has something to do with this: string_format:"%2.f", I
suppose you wanted %.2f instead of %2.f , notice where the decimal
point is.

http://smarty.php.net/manual/en/language.modifier.string.format.php

--
Rami.Elomaa@gmail.com
"Olemme apinoiden planeetalla."

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация