AtkCurrencyAttribute: Difference between revisions
Appearance
Rwolverine (talk | contribs) No edit summary |
formatting |
||
| Line 4: | Line 4: | ||
=== Params === | === Params === | ||
The constructor of the atkCurrencyAttribute has the following params: | The constructor of the atkCurrencyAttribute has the following params: | ||
atkCurrencyAttribute (string $name, [int $flags = 0], [int $size = 10], [string $currencysymbol = ""], [int $decimals = 2], [string $decimalseparator = ""], [string $thousandsseparator = ""]) | |||
;name String | |||
:Name of the attribute (unique within a node, and for most attributes, corresponds to a field in the database. | |||
;flags (optional) int | |||
:Flags for the attribute. For more information about flags, please checkout the [[flags]] section. | |||
;size (optional) int | |||
:The max. number of characters that can be entered. If not specified, or set to 0, the max. size is automatically retrieved from the table metadata. | |||
;currencysymbol (optional) mixed | |||
:The symbol of currancy for your location | |||
;decimals (optional) int | |||
:The number of decimal places | |||
;decimalseperator (optional) mixed | |||
:if you use a character other than "." for yoru decimal place you can change it here | |||
;thousandsseperator (optional) mixed | |||
:if allows you to set a thousands operator usually "," | |||
=== Examples === | === Examples === | ||
(in a [[node]] constructor): | (in a [[node]] constructor): | ||
$this->add(new atkCurrencyAttribute("pieceprice | <syntaxhighlight lang="php"> | ||
$this->add(new atkCurrencyAttribute("pieceprice", AF_HIDE_LIST|AF_FORCE_LOAD, 12, "$", 5)); | |||
</syntaxhighlight> | |||
Adds a field 'pieceprice' to the node that displays as US Dollars, and has a precsion of 5 decimal places. The flags hide it from the list view, | Adds a field 'pieceprice' to the node that displays as US Dollars, and has a precsion of 5 decimal places. The flags hide it from the list view, | ||
[[Category:Attributes]] | [[Category:Attributes]] | ||
--[[User:Rwolverine|Rwolverine]] 19:54, 6 December 2007 (CET) | --[[User:Rwolverine|Rwolverine]] 19:54, 6 December 2007 (CET) | ||
Revision as of 19:47, 7 December 2007
Description
The atkCurrancyAttribute is used to represent currancy values.
Params
The constructor of the atkCurrencyAttribute has the following params:
atkCurrencyAttribute (string $name, [int $flags = 0], [int $size = 10], [string $currencysymbol = ""], [int $decimals = 2], [string $decimalseparator = ""], [string $thousandsseparator = ""])
- name String
- Name of the attribute (unique within a node, and for most attributes, corresponds to a field in the database.
- flags (optional) int
- Flags for the attribute. For more information about flags, please checkout the flags section.
- size (optional) int
- The max. number of characters that can be entered. If not specified, or set to 0, the max. size is automatically retrieved from the table metadata.
- currencysymbol (optional) mixed
- The symbol of currancy for your location
- decimals (optional) int
- The number of decimal places
- decimalseperator (optional) mixed
- if you use a character other than "." for yoru decimal place you can change it here
- thousandsseperator (optional) mixed
- if allows you to set a thousands operator usually ","
Examples
(in a node constructor):
$this->add(new atkCurrencyAttribute("pieceprice", AF_HIDE_LIST|AF_FORCE_LOAD, 12, "$", 5));
Adds a field 'pieceprice' to the node that displays as US Dollars, and has a precsion of 5 decimal places. The flags hide it from the list view,
--Rwolverine 19:54, 6 December 2007 (CET)