Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

number to words

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Demerzel
Smarty Rookie


Joined: 31 Jan 2010
Posts: 26

PostPosted: Sun Sep 25, 2011 7:02 pm    Post subject: number to words Reply with quote

whether it is possible to change numbers to words.
For example to make smarty write "two" when varible is 2?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sun Sep 25, 2011 8:17 pm    Post subject: Reply with quote

write a modifier that changes numbers to words.
Back to top
View user's profile Send private message Visit poster's website
Demerzel
Smarty Rookie


Joined: 31 Jan 2010
Posts: 26

PostPosted: Mon Sep 26, 2011 5:47 pm    Post subject: Reply with quote

Your answer is so instructive, You could just as well not waste the time to write anything.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Sep 26, 2011 6:54 pm    Post subject: Reply with quote

Demerzel wrote:
Your answer is so instructive, You could just as well not waste the time to write anything.


Ok I'll elaborate. Yes it is possible, but first you need a PHP function that changes numbers to words, something like number2word($number) {...} (If you have trouble writing that, there are plenty of general PHP developer sources around the web.) Once you have that accomplished, you can write a plugin (modifier) to run your variable through that function such as {$myvar|num2word}. The instructions for how to implement a modifier plugin are very clearly defined in the online documentation.

You could also search and see if this has been done before, which it appears jacz has done this work for you.

Is that more helpful?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General 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