Welcome Guest, Not a member yet? Register   Sign In
Number Helper
#13

[eluser]sophistry[/eluser]
hi derek,

it's just that plural() doesn't do what i needed. i don't want cluttery conditional code in the view so i made a helper that tucks the conditionals into a function.

e.g., if it were coded using plural() in the view it would still have "if count !=1 then plural() else singular()" clauses in the view, which is - IMO - !pretty. additionally, the plural() function is built for english only.

with the little helper function count_and_label() you get language support (because you are in full control of what the pluralized strings are) plus the counting AND the labeling right in the view. i think it's pretty neat. :-)

i'd also like to see a number_format library or set of helpers go out with the CI distribution.


Messages In This Thread
Number Helper - by El Forum - 10-06-2007, 01:38 AM
Number Helper - by El Forum - 10-06-2007, 07:08 AM
Number Helper - by El Forum - 10-06-2007, 01:08 PM
Number Helper - by El Forum - 10-06-2007, 03:50 PM
Number Helper - by El Forum - 10-06-2007, 04:10 PM
Number Helper - by El Forum - 10-07-2007, 08:43 AM
Number Helper - by El Forum - 10-07-2007, 01:13 PM
Number Helper - by El Forum - 10-07-2007, 01:29 PM
Number Helper - by El Forum - 10-07-2007, 02:56 PM
Number Helper - by El Forum - 10-07-2007, 05:33 PM
Number Helper - by El Forum - 12-16-2007, 11:51 AM
Number Helper - by El Forum - 12-16-2007, 06:49 PM
Number Helper - by El Forum - 12-16-2007, 10:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB