CDBResult
CCurrency::GetList(
string &by,
string &order,
string lang = LANGUAGE_ID
);
The method GetList returns a sorted list of currencies. The language
dependent values are returned for the language specified in the parameter lang
which is the current language by default.
Parameters
Parameter | Description |
by |
Variable containing the currency sort order. The following values are
possible:
- currency - currency identifier;
- name - name of currency in the language lang;
- sort - sort index (default).
|
order |
Variable containing the sort direction. The following values are
possible:
- asc - ascending (default);
- desc - descending.
|
lang |
The ID of the language for which the language dependent values are
returned. |
Return Values
Returns an instance of the CDBResult
class, each record in which is an array with the following keys.
Key |
Description |
CURRENCY |
The three character currency code. |
AMOUNT_CNT |
The number of currency units used by default to define the rate
of exchange (for example, if CYP 10 equal to USD 21.58, 10 is the number
of currency units). |
AMOUNT |
The default rate of exchange. (One of currencies within a site
must equal to 1. Such currency is called a base currency. Other
currencies are defined relative to the base currency.) |
SORT |
Sort order. |
DATE_UPDATE |
The date that the record was last modified. |
LID |
The language ID. |
FORMAT_STRING |
Format string used to display amounts in this currency. |
FULL_NAME |
Full name of the currency. |
DEC_POINT |
Symbol used as decimal point when displaying amounts in this currency. |
THOUSANDS_SEP |
Symbol used as thousands separator when displaying amounts in this currency. |
DECIMALS |
Number of digits in the fractional part of an amount. |
Example
<?
// Display the list of currencies in the current language, sorted by name.
// Besides, display 11.95 in the format of this currency in the current language.
$lcur = CCurrency::GetList(($b="name"), ($order1="asc"), LANGUAGE_ID);
while($lcur_res = $lcur->Fetch())
{
echo "[".$lcur_res["CURRENCY"]."] ".$lcur_res["FULL_NAME"].": ";
echo CurrencyFormat(11.95, $lcur_res["CURRENCY"])."<br>";
}
?>