rah_format_size
Published under current TXP projects
Format a size in bytes to appropiarite format.
Image: rah_format_size
Requirements
- PHP 4.3.0+
- Textpattern 4.x.x+
Installation
The general behavior stands: paste plugin code to the plugin installer textarea and run the automatic setup. Then just activate the plugin and you are ready to use new tags that plugin includes like others.
Attributes
The tag is <txp:rah_format_size /> and attributes for it follow.
value
Value (size) to format. Default is unset.
Example: value="10000" Default: ""
decimals
Number of decimals to round.
Example: decimals="2" Default: "0"
prefixes
Defines used SI-prefixes.
Example: label=" byte, kilobyte, megabyte" Default: " B, kB, MB, GB, TB, PB, EB, ZB, YB"
Examples
Example #1: Using as self-closing tag.
<txp:rah_format_size value="10000" />
Returns: 10 kB
Example #1: Container usage.
<txp:rah_format_size>
1000000
</txp:rah_format_size>
Returns: 1 MB
Changelog
Version 0.1
- First release