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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: 24249 -->
<!-- Reviewed: no -->
<sect1 id="zend.measure.output">
<title>Ausgabe von Maßeinheiten</title>
<para>
Maßeinheiten können auf verschiedenen Wegen als Zahl ausgegeben werden.
</para>
<para>
<link linkend="zend.measure.output.auto">Automatische Ausgabe</link>
</para>
<para>
<link linkend="zend.measure.output.value">Ausgabe als Wert</link>
</para>
<para>
<link linkend="zend.measure.output.unit">Ausgabe mit einer Maßeinheit</link>
</para>
<para>
<link linkend="zend.measure.output.unit">Ausgabe als lokalisierte Zeichenkette</link>
</para>
<sect2 id="zend.measure.output.auto">
<title>Automatische Ausgabe</title>
<para>
<classname>Zend_Measure</classname> unterstützt die automatische Ausgabe von
Zeichenketten.
<example id="zend.measure.output.auto.example-1">
<title>Automatische Ausgabe</title>
<programlisting language="php"><![CDATA[
$locale = new Zend_Locale('de');
$mystring = "1.234.567,89";
$unit = new Zend_Measure_Length($mystring,
Zend_Measure_Length::STANDARD,
$locale);
echo $unit;
]]></programlisting>
</example>
</para>
<note>
<title>Ausgabe der Maßeinheit</title>
<para>
Die Ausgabe kann einfach erzielt werden durch Verwendung von
<ulink url="http://php.net/echo">echo</ulink> oder
<ulink url="http://php.net/print">print</ulink>.
</para>
</note>
</sect2>
<sect2 id="zend.measure.output.value">
<title>Ausgabe als Wert</title>
<para>
Der Wert einer Maßeinheit kann mit <methodname>getValue()</methodname> ausgegeben
werden.
<example id="zend.measure.output.value.example-1">
<title>Ausgabe eines Wertes</title>
<programlisting language="php"><![CDATA[
$locale = new Zend_Locale('de');
$mystring = "1.234.567,89";
$unit = new Zend_Measure_Length($mystring,
Zend_Measure_Length::STANDARD,
$locale);
echo $unit->getValue();
]]></programlisting>
</example>
</para>
<para>
Die <methodname>getValue()</methodname> Methode akzeptiert einen optionalen Parameter
<property>round</property> der es erlaubt eine Genauigkeit für die erstellte Ausgabe zu
definieren. Die Standardgenauigkeit ist '2'.
</para>
</sect2>
<sect2 id="zend.measure.output.unit">
<title>Ausgabe mit einer Maßeinheit</title>
<para>
Die Funktion <methodname>getType()</methodname> gibt die aktuelle Maßeinheit zurück.
<example id="zend.measure.output.unit.example-1">
<title>Outputting units</title>
<programlisting language="php"><![CDATA[
$locale = new Zend_Locale('de');
$mystring = "1.234.567,89";
$unit = new Zend_Measure_Weight($mystring,
Zend_Measure_Weight::POUND,
$locale);
echo $unit->getType();
]]></programlisting>
</example>
</para>
</sect2>
<sect2 id="zend.measure.output.localized">
<title>Ausgabe als lokalisierte Zeichenkette</title>
<para>
Die Ausgabe einer Zeichenkette in einem Format welches in dem Land des Benutzers üblich
ist, ist normalerweise gewünscht Die Maßeinheit "1234567.8" würde im Deutschen zum
Beispiel zu "1.234.567,8" werden. Diese Funktionalität wird in einem zukünftigen Release
unterstützt.
</para>
</sect2>
</sect1>
|