1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.currency.position">
<title>Where is the currency?</title>
<para>
The position where the currency sign or name will be displayed depends on the locale.
Still, when you want to define this setting yourself you have to use the
<property>display</property> option and provide one of the following constants:
</para>
<table id="zend.currency.position.table-1">
<title>Available positions for the currency</title>
<tgroup cols="2" align="left">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>STANDARD</constant></entry>
<entry>Sets the standard position as defined within the locale</entry>
</row>
<row>
<entry><constant>RIGHT</constant></entry>
<entry>
Displays the currency representation at the right side of the value
</entry>
</row>
<row>
<entry><constant>LEFT</constant></entry>
<entry>
Displays the currency representation at the left side of the value
</entry>
</row>
</tbody>
</tgroup>
</table>
<example id="zend.currency.position.example-1">
<title>Setting the currency position</title>
<para>
Let's assume that your client has again set "en_US" as locale. Using no option the
returned value could look like this:
</para>
<programlisting language="php"><![CDATA[
$currency = new Zend_Currency(
array(
'value' => 100,
)
);
print $currency; // Could return '$ 100'
]]></programlisting>
<para>
So by using the default setting the currency (in our case $) could either be
rendered left or right from the value. Now let's define a fixed position:
</para>
<programlisting language="php"><![CDATA[
$currency = new Zend_Currency(
array(
'value' => 100,
'position' => Zend_Currency::RIGHT,
)
);
print $currency; // Could return '100 $';
]]></programlisting>
<para>
Note that in the second snippet the position of <acronym>USD</acronym> is fixed
regardless of the used locale or currency.
</para>
</example>
</sect1>
|