Smarty The discussions here are for Smarty, a template engine for the PHP programming language.
Author Message
rehman
Smarty n00b

Joined: 16 May 2019
Posts: 1

 Posted: Thu May 16, 2019 10:27 am    Post subject: Problem bei der Berechnung Ich habe Problem bei der Berechnung wegen Komma und Punkt. bei einem Variable (Gesamtsumme) möchte ich 23,50 Euro addieren. z.B 1000+23,50 = 1.023,50 das muss Ergebnis und format sein. Da Smarty kein Komma akzeptiert. schreibe ich 23.50. Beispiel: {assign var = "amount" value =\$variable|replace:',':'.'} {math equation = "x+y" x=\$amount y=23.50 format="%.2f"} als Ergebnis addiert der Variable 1000+23.500 statt 23,50 und gib 24.500 Euro Es muss so sein 1.000+23,50= 1.023,50
AnrDaemon

Joined: 03 Dec 2012
Posts: 1633

 Posted: Sat May 18, 2019 11:17 am    Post subject: Either do your calculation before calling Smarty, or don't pass pre-formatted values to Smarty. Preferable both. Totals calculation is part of business logic of your app and should be done in app, not in template, and formatting should be done in the template, not in the app.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT Page 1 of 1

 Jump to: Select a forum General----------------AnnouncementsInstallation and SetupFAQ (Frequently Asked Questions)TestimonialsShowcaseHelp Wanted (commercial) User Supported Help----------------GeneralTips and TricksPluginsAdd-onsFrameworksArticle Discussions Development----------------Smarty DevelopmentFeature RequestsBugsDocumentationSmarty 3 International Discussions----------------Language: GermanLanguage: FrenchLanguage: PortugueseLanguage: RussianLanguage: SpanishLanguage: ItalianLanguage: JapaneseLanguage: PersianLanguage: PolishLanguage: Indonesian
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