[ic] Price Digit Display Question
Kevin Walsh
kevin at cursor.biz
Fri Apr 16 09:11:54 EDT 2004
sales at mirajewelry.com wrote:
> I've been using Interchange for about 2 years now (currently running
> Interchange 5.0.1) and have been doing a major overhaul to my site
> (haven't gone live yet) and I want to strip the two trailing cent digits
> from the results display if they are zero i.e. $28.00 would display as
> $28 (no decimal) but $3.95 would not change.
>
> I have tried searching the archives, and it's probably there, I just can't
> seem to find it. Any help would be GREATLY appreciated.
>
I would have suggested setting up your locale to set the frac_digits
to 0, but as you want to only strip ".00" that wouldn't do what you
want.
You should either post-process the output of the [currency] tag, with
a line of Perl, or create a UserTag of your own. I suggest creating a
UserTag if you intend to make use of this all over your website.
For instance, You could create [my-currency], which would call the
[currency] tag and then strip the trailing ".00" - if present. Once
you have that working, simply replace all calls to [currency] with your
new [my-currency] UserTag and process calls to other price values with
your new UserTag.
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin at cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
More information about the interchange-users
mailing list