Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Download count: Adding a comma separator to thousands, millions, etc.
Is it possible to display files with more than 999 downloads with comma separators in their download counts—ie. as “1,001” instead of “1001”?
Offline
Re: Download count: Adding a comma separator to thousands, millions, etc.
You could pass it through number_format()
function, e.g.
<txp:etc_query data="{?downloads|0|number_format}" globals="thisfile" />
or rah_function
, or raw <txp:php />
.
Edit: or more robust
<txp:etc_query data='{?|<txp:file_download_downloads />|number_format}' />
Last edited by etc (2014-09-29 08:02:17)
Offline
Re: Download count: Adding a comma separator to thousands, millions, etc.
Using rah_function you could use number_format to format the value. Something along the lines of:
<txp:rah_function call="number_format" number='<txp:file_download_downloads />' decimals="0" decimal_point="." thousands_separator="," />
Offline
Re: Download count: Adding a comma separator to thousands, millions, etc.
Thank you, friends! I’ll work on this again Wednesday and I’ll report back if anything goes amiss. But I anticipate this will solve the problem with grace. Cheers!
Offline