Zend_Measure-Output.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- EN-Revision: 15157 -->
  3. <!-- Reviewed: no -->
  4. <sect1 id="zend.measure.output">
  5. <title>Ausgabe von Maßeinheiten</title>
  6. <para>
  7. Maßeinheiten können auf verschiedenen Wegen als Zahl ausgegeben werden.
  8. </para>
  9. <para>
  10. <link linkend="zend.measure.output.auto"><code>Automatische Ausgabe</code>
  11. </link>
  12. </para>
  13. <para>
  14. <link linkend="zend.measure.output.value"><code>Ausgabe als Wert</code>
  15. </link>
  16. </para>
  17. <para>
  18. <link linkend="zend.measure.output.unit"><code>Ausgabe mit einer Maßeinheit</code>
  19. </link>
  20. </para>
  21. <para>
  22. <link linkend="zend.measure.output.unit"><code>Ausgabe als lokalisierte Zeichenkette</code>
  23. </link>
  24. </para>
  25. <sect2 id="zend.measure.output.auto">
  26. <title>Automatische Ausgabe</title>
  27. <para>
  28. <classname>Zend_Measure</classname> unterstützt die automatische Ausgabe von Zeichenketten.
  29. <example id="zend.measure.output.auto.example-1">
  30. <title>Automatische Ausgabe</title>
  31. <programlisting role="php"><![CDATA[
  32. $locale = new Zend_Locale('de');
  33. $mystring = "1.234.567,89 Meter";
  34. $unit = new Zend_Measure_Length($mystring,
  35. Zend_Measure_Length::STANDARD,
  36. $locale);
  37. echo $unit;
  38. ]]></programlisting>
  39. </example>
  40. </para>
  41. <note>
  42. <title>Ausgabe der Maßeinheit</title>
  43. <para>
  44. Die Ausgabe kann einfach erzielt werden durch Verwendung von
  45. <ulink url="http://php.net/echo"><code>echo</code></ulink> oder
  46. <ulink url="http://php.net/print"><code>print</code></ulink>.
  47. </para>
  48. </note>
  49. </sect2>
  50. <sect2 id="zend.measure.output.value">
  51. <title>Ausgabe als Wert</title>
  52. <para>
  53. Der Wert einer Maßeinheit kann mit <code>getValue()</code> ausgegeben werden.
  54. <example id="zend.measure.output.value.example-1">
  55. <title>Ausgabe eines Wertes</title>
  56. <programlisting role="php"><![CDATA[
  57. $locale = new Zend_Locale('de');
  58. $mystring = "1.234.567,89 Meter";
  59. $unit = new Zend_Measure_Length($mystring,
  60. Zend_Measure_Length::STANDARD,
  61. $locale);
  62. echo $unit->getValue();
  63. ]]></programlisting>
  64. </example>
  65. </para>
  66. <para>
  67. Die <code>getValue()</code> Methode akzeptiert einen optionalen Parameter '<code>round</code>'
  68. der es erlaubt eine Genauigkeit für die erstellte Ausgabe zu definieren. Die Standardgenauigkeit ist
  69. '<code>2</code>'.
  70. </para>
  71. </sect2>
  72. <sect2 id="zend.measure.output.unit">
  73. <title>Ausgabe mit einer Maßeinheit</title>
  74. <para>
  75. Die Funktion <code>getType()</code> gibt die aktuelle Maßeinheit zurück.
  76. <example id="zend.measure.output.unit.example-1">
  77. <title>Outputting units</title>
  78. <programlisting role="php"><![CDATA[
  79. $locale = new Zend_Locale('de');
  80. $mystring = "1.234.567,89";
  81. $unit = new Zend_Measure_Weight($mystring,
  82. Zend_Measure_Weight::POUND,
  83. $locale);
  84. echo $unit->getType();
  85. ]]></programlisting>
  86. </example>
  87. </para>
  88. </sect2>
  89. <sect2 id="zend.measure.output.localized">
  90. <title>Ausgabe als lokalisierte Zeichenkette</title>
  91. <para>
  92. Die Ausgabe einer Zeichenkette in einem Format welches in dem Land des Benutzers üblich ist, ist
  93. normalerweise gewünscht Die Maßeinheit "1234567.8" würde im Deutschen zum Beispiel zu
  94. "1.234.567,8" werden. Diese Funktionalität wird in einem zukünftigen Release unterstützt.
  95. </para>
  96. </sect2>
  97. </sect1>
  98. <!--
  99. vim:se ts=4 sw=4 et:
  100. -->