| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?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>
|