mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-03 22:01:36 +01:00 
			
		
		
		
	- updates for new build system - added missing files - corrections from users - revcheck comments for all files - big up to didou and nuno, brilliant work - make test: ok - make: ok
		
			
				
	
	
		
			153 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			153 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
<?xml version="1.0" encoding="iso-8859-1"?>
 | 
						|
<!-- $Revision$ -->
 | 
						|
<!-- EN-Revision: 1.1 Maintainer: andreas Status: ready -->
 | 
						|
		<sect1 id="language.function.math">
 | 
						|
			<title>math (Mathematik)</title>
 | 
						|
            <informaltable frame="all">
 | 
						|
                <tgroup cols="5">
 | 
						|
                <colspec colname="param" align="center" />
 | 
						|
                <colspec colname="type" align="center" />
 | 
						|
                <colspec colname="required" align="center" />
 | 
						|
                <colspec colname="default" align="center" />
 | 
						|
                <colspec colname="desc" />
 | 
						|
                <thead>
 | 
						|
                    <row>
 | 
						|
                        <entry>Attribut Name</entry>
 | 
						|
                        <entry>Typ</entry>
 | 
						|
                        <entry>Erforderlich</entry>       
 | 
						|
                        <entry>Standardwert</entry>
 | 
						|
                        <entry>Beschreibung</entry>
 | 
						|
                    </row>
 | 
						|
                </thead>
 | 
						|
                <tbody>
 | 
						|
                    <row>
 | 
						|
                        <entry>equation</entry>
 | 
						|
                        <entry>string</entry>
 | 
						|
                        <entry>Ja</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Der auszuführende Vergleich.</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>format</entry>
 | 
						|
                        <entry>string</entry>
 | 
						|
                        <entry>Nein</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Format der Ausgabe. (sprintf)</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>var</entry>
 | 
						|
                        <entry>numeric</entry>
 | 
						|
                        <entry>Ja</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Wert der Vergleichsvariable.</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>assign</entry>
 | 
						|
                        <entry>string</entry>
 | 
						|
                        <entry>Nein</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Template-Variable welcher die Ausgabe zugewiesen werden soll.</entry>
 | 
						|
                    </row>
 | 
						|
                    <row>
 | 
						|
                        <entry>[var ...]</entry>
 | 
						|
                        <entry>numeric</entry>
 | 
						|
                        <entry>Yes</entry>
 | 
						|
                        <entry><emphasis>n/a</emphasis></entry>
 | 
						|
                        <entry>Zusätzliche Werte.</entry>
 | 
						|
                    </row>
 | 
						|
                </tbody>
 | 
						|
                </tgroup>
 | 
						|
            </informaltable>
 | 
						|
			<para>
 | 
						|
			'math' ermöglicht es dem Designer, mathematische Gleichungen
 | 
						|
			durchzuführen. Alle numerischen Template-Variablen
 | 
						|
			können dazu verwendet werden und die Ausgabe wird an
 | 
						|
			die Stelle des Tags geschrieben. Die Variablen werden
 | 
						|
			der Funktion als Parameter übergeben, dabei kann es sich
 | 
						|
			um statische oder um Template-Variablen handeln. Erlaubte Operatoren
 | 
						|
			umfassen: +, -, /, *, abs, ceil, cos, exp, floor, log, log10, max,
 | 
						|
			min, pi, pow, rand, round, sin, sqrt, srans und tan. Konsultieren Sie
 | 
						|
			die PHP-Dokumentation für zusätzliche Informationen zu dieser
 | 
						|
			Funktion.
 | 
						|
			</para>
 | 
						|
			<para>
 | 
						|
			Falls Sie die spezielle 'assign' Variable übergeben, wird die
 | 
						|
			Ausgabe der 'math'-Funktion der Template-Variablen mit dem selben
 | 
						|
			Namen zugewiesen anstatt ausgegeben zu werden.
 | 
						|
			</para>
 | 
						|
			<note>
 | 
						|
				<title>Technische Bemerkung</title>
 | 
						|
				<para>
 | 
						|
				Die 'math'-Funktion ist wegen ihres Gebrauchs der 'eval()'-Funktion
 | 
						|
				äusserst Ressourcen intensiv. Mathematik direkt im PHP-Skript
 | 
						|
				zu verwenden ist wesentlich performanter. Sie sollten daher
 | 
						|
				- wann immer möglich - auf die Verwendung verzichten. Stellen
 | 
						|
				Sie jedoch auf jeden Fall sicher, dass Sie keine 'math'-Tags in 'sections'
 | 
						|
				oder anderen 'loop'-Konstrukten verwenden.
 | 
						|
            	</para>
 | 
						|
			</note>
 | 
						|
<example>
 | 
						|
<title>math (Mathematik)</title>
 | 
						|
<programlisting>
 | 
						|
{* $height=4, $width=5 *}
 | 
						|
 | 
						|
{math equation="x + y" x=$height y=$width}
 | 
						|
 | 
						|
AUSGABE:
 | 
						|
 | 
						|
9
 | 
						|
 | 
						|
 | 
						|
{* $row_height = 10, $row_width = 20, #col_div# = 2, aus Template zugewiesen *}
 | 
						|
 | 
						|
{math equation="height * width / division"
 | 
						|
      height=$row_height
 | 
						|
      width=$row_width
 | 
						|
      division=#col_div#}
 | 
						|
 | 
						|
AUSGABE:
 | 
						|
 | 
						|
100
 | 
						|
 | 
						|
 | 
						|
 | 
						|
{* Sie können auch Klammern verwenden *}
 | 
						|
 | 
						|
{math equation="(( x + y ) / z )" x=2 y=10 z=2}
 | 
						|
 | 
						|
AUSGABE:
 | 
						|
 | 
						|
6
 | 
						|
 | 
						|
 | 
						|
 | 
						|
{* Sie können als Ausgabeformat alle von sprintf unterstötzen Definitionen verwenden *}
 | 
						|
 | 
						|
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
 | 
						|
 | 
						|
AUSGABE:
 | 
						|
 | 
						|
9.44</programlisting>
 | 
						|
</example>
 | 
						|
</sect1>
 | 
						|
<!-- Keep this comment at the end of the file
 | 
						|
Local variables:
 | 
						|
mode: sgml
 | 
						|
sgml-omittag:t
 | 
						|
sgml-shorttag:t
 | 
						|
sgml-minimize-attributes:nil
 | 
						|
sgml-always-quote-attributes:t
 | 
						|
sgml-indent-step:1
 | 
						|
sgml-indent-data:t
 | 
						|
indent-tabs-mode:nil
 | 
						|
sgml-parent-document:nil
 | 
						|
sgml-default-dtd-file:"../../../../manual.ced"
 | 
						|
sgml-exposed-tags:nil
 | 
						|
sgml-local-catalogs:nil
 | 
						|
sgml-local-ecat-files:nil
 | 
						|
End:
 | 
						|
vim600: syn=xml fen fdm=syntax fdl=2 si
 | 
						|
vim: et tw=78 syn=sgml
 | 
						|
vi: ts=1 sw=1
 | 
						|
-->
 |