mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
sync with en
This commit is contained in:
@@ -1,8 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.8 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.10 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.capture">
|
<sect1 id="language.function.capture">
|
||||||
<title>capture (Ausgabe abfangen)</title>
|
<title>{capture} (Ausgabe abfangen)</title>
|
||||||
|
<para>
|
||||||
|
{capture} wird verwendet, um die Template-Ausgabe abzufangen und in
|
||||||
|
einer Variable zu speichern. Der Inhalt zwischen {capture
|
||||||
|
name="foo"} und {/capture} wird unter der im 'name' Attribut
|
||||||
|
angegebenen Capture-Variablen abgelegt und kann <20>ber <link
|
||||||
|
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
|
||||||
|
angesprochen werden. Falls kein 'name'-Attribut <20>bergeben wurde,
|
||||||
|
wird der Inhalt in 'default' (also $smarty.capture.default)
|
||||||
|
abgelegt. Jede {capture} Sektion muss mit {/capture} beendet
|
||||||
|
werden. {capture}-Bl<42>cke k<>nnen verschachtelt sein.
|
||||||
|
</para>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -37,25 +48,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
'capture' wird verwendet, um die Template-Ausgabe abzufangen und in
|
|
||||||
einer Variable zu speichern. Der Inhalt zwischen {capture
|
|
||||||
name="foo"} und {/capture} wird unter der im 'name' Attribut
|
|
||||||
angegebenen Capture-Variablen abgelegt und kann <20>ber <link
|
|
||||||
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
|
|
||||||
angesprochen werden. Falls kein 'name'-Attribut <20>bergeben wurde,
|
|
||||||
wird der Inhalt in 'default' (also $smarty.capture.default)
|
|
||||||
abgelegt. Jede {capture} Sektion muss mit {/capture} beendet
|
|
||||||
werden. 'capture'-Bl<42>cke k<>nnen verschachtelt sein.
|
|
||||||
</para>
|
|
||||||
<note>
|
|
||||||
<title>Technische Bemerkung</title>
|
|
||||||
<para>
|
|
||||||
Smarty 1.4.0 - 1.4.4 speicherte den abgefangenen Inhalt in der
|
|
||||||
Variable '$return'. Seit 1.4.5 wird das 'name'-Attribut verwenden.
|
|
||||||
Bitte passen Sie Ihre Templates entsprechend an.
|
|
||||||
</para>
|
|
||||||
</note>
|
|
||||||
<caution>
|
<caution>
|
||||||
<para>
|
<para>
|
||||||
Seien Sie vorsichtig, wenn sie die Ausgabe von <link
|
Seien Sie vorsichtig, wenn sie die Ausgabe von <link
|
||||||
@@ -74,7 +66,7 @@
|
|||||||
|
|
||||||
{* Tabellenzeile nur ausgeben, wenn Inhalt vorhanden *}
|
{* Tabellenzeile nur ausgeben, wenn Inhalt vorhanden *}
|
||||||
{capture name=banner}
|
{capture name=banner}
|
||||||
{include file="get_banner.tpl"}
|
{include file='get_banner.tpl'}
|
||||||
{/capture}
|
{/capture}
|
||||||
{if $smarty.capture.banner ne ""}
|
{if $smarty.capture.banner ne ""}
|
||||||
<table>
|
<table>
|
||||||
@@ -88,6 +80,31 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<example>
|
||||||
|
<title>Template-Inhalte abfangen</title>
|
||||||
|
<para>
|
||||||
|
Hier ist ein Beispiel das das Zusammenspiel mit der Funktion <link
|
||||||
|
linkend="language.function.popup">{popup}</link> demonstriert.
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
{capture name=some_content assign=popText}
|
||||||
|
.... some content ....
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
<a href="#" {popup caption='Help' text=$popText}>help</a>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
</example>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Siehe auch:
|
||||||
|
<link
|
||||||
|
linkend="language.variables.smarty.capture">$smarty.capture</link>,
|
||||||
|
<link linkend="language.function.eval">{eval}</link>,
|
||||||
|
<link linkend="language.function.fetch">{fetch}</link>,
|
||||||
|
<link linkend="api.fetch">fetch()</link>
|
||||||
|
and <link linkend="language.function.assign">{assign}</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -1,8 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.9 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.11 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.config.load">
|
<sect1 id="language.function.config.load">
|
||||||
<title>config_load (Konfiguration laden)</title>
|
<title>{config_load} (Konfiguration laden)</title>
|
||||||
|
<para>
|
||||||
|
Diese Funktion wird verwendet, um <link
|
||||||
|
linkend="language.config.variables">Variablen aus einer
|
||||||
|
Konfigurationsdatei</link> in das Template zu laden. Sehen sie
|
||||||
|
<link linkend="config.files">Config Files
|
||||||
|
(Konfigurationsdateien)</link> f<>r weitere Informationen.
|
||||||
|
</para>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -64,15 +71,8 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
Diese Funktion wird verwendet, um <link
|
|
||||||
linkend="language.config.variables">Variablen aus einer
|
|
||||||
Konfigurationsdatei</link> in das Template zu laden. Sehen sie
|
|
||||||
<link linkend="config.files">Config Files
|
|
||||||
(Konfigurationsdateien)</link> f<>r weitere Informationen.
|
|
||||||
</para>
|
|
||||||
<example>
|
<example>
|
||||||
<title>Funktion config_load</title>
|
<title>Funktion {config_load}</title>
|
||||||
<para>
|
<para>
|
||||||
beispiel.conf
|
beispiel.conf
|
||||||
</para>
|
</para>
|
||||||
@@ -94,7 +94,7 @@ seitenTitel = "Kundeninfo"
|
|||||||
<para>and the template</para>
|
<para>and the template</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{config_load file="example.conf"}
|
{config_load file='example.conf'}
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<title>{#seitenTitel#}</title>
|
<title>{#seitenTitel#}</title>
|
||||||
@@ -124,7 +124,7 @@ seitenTitel = "Kundeninfo"
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Funktion config_load mit Abschnitten</title>
|
<title>Funktion {config_load} mit Abschnitten</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{config_load file="beispiel.conf" section="Kunde"}
|
{config_load file="beispiel.conf" section="Kunde"}
|
||||||
@@ -143,7 +143,11 @@ seitenTitel = "Kundeninfo"
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
Siehe <link
|
||||||
|
linkend="variable.config.overwrite">$config_overwrite</link>
|
||||||
|
bez<65>glich Arrays von Konfigurationsvariablen.
|
||||||
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Siehe auch <link
|
Siehe auch <link
|
||||||
linkend="config.files">Konfigurationsdateien</link>, <link
|
linkend="config.files">Konfigurationsdateien</link>, <link
|
||||||
|
@@ -1,8 +1,29 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.7 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.8 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.foreach">
|
<sect1 id="language.function.foreach">
|
||||||
<title>{foreach}, {foreachelse}</title>
|
<title>{foreach}, {foreachelse}</title>
|
||||||
|
<para>
|
||||||
|
Die <emphasis>foreach</emphasis> Schleife ist eine Alternative zu
|
||||||
|
<link
|
||||||
|
linkend="language.function.section"><emphasis>section</emphasis></link>.
|
||||||
|
<emphasis>foreach</emphasis> wird verwendet, um ein assoziatives
|
||||||
|
Array zu durchlaufen. Die Syntax von
|
||||||
|
<emphasis>foreach</emphasis>-Schleifen ist viel einfacher als die
|
||||||
|
von <emphasis>section</emphasis>. <emphasis>{foreach}</emphasis>
|
||||||
|
Tags m<>ssen mit <emphasis>{/foreach}</emphasis> tags kombiniert
|
||||||
|
werden. Erforderliche Parameter sind: <emphasis>from</emphasis> und
|
||||||
|
<emphasis>item</emphasis>. Der Name der {foreach}-Schleife kann
|
||||||
|
frei vergeben werden und sowohl Buchstaben, Zahlen als auch
|
||||||
|
Unterstriche enthalten. <emphasis>foreach</emphasis>-Schleifen
|
||||||
|
k<>nnen verschachtelt werden, dabei ist zu beachten, dass sich die
|
||||||
|
definierten Namen voneinander unterscheiden. Die
|
||||||
|
<emphasis>from</emphasis> Variable (normalerweise ein assoziatives
|
||||||
|
Array) definiert die Anzahl der von <emphasis>foreach</emphasis> zu
|
||||||
|
durchlaufenen Iterationen. <emphasis>foreachelse</emphasis> wird
|
||||||
|
ausgef<65>hrt wenn keine Werte in der <emphasis>from</emphasis>
|
||||||
|
Variable <20>bergeben wurden.
|
||||||
|
</para>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -51,28 +72,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
|
|
||||||
Die <emphasis>foreach</emphasis> Schleife ist eine Alternative zu
|
|
||||||
<link
|
|
||||||
linkend="language.function.section"><emphasis>section</emphasis></link>.
|
|
||||||
<emphasis>foreach</emphasis> wird verwendet, um ein assoziatives
|
|
||||||
Array zu durchlaufen. Die Syntax von
|
|
||||||
<emphasis>foreach</emphasis>-Schleifen ist viel einfacher als die
|
|
||||||
von <emphasis>section</emphasis>. <emphasis>{foreach}</emphasis>
|
|
||||||
Tags m<>ssen mit <emphasis>{/foreach}</emphasis> tags kombiniert
|
|
||||||
werden. Erforderliche Parameter sind: <emphasis>from</emphasis> und
|
|
||||||
<emphasis>item</emphasis>. Der Name der {foreach}-Schleife kann
|
|
||||||
frei vergeben werden und sowohl Buchstaben, Zahlen als auch
|
|
||||||
Unterstriche enthalten. <emphasis>foreach</emphasis>-Schleifen
|
|
||||||
k<>nnen verschachtelt werden, dabei ist zu beachten, dass sich die
|
|
||||||
definierten Namen voneinander unterscheiden. Die
|
|
||||||
<emphasis>from</emphasis> Variable (normalerweise ein assoziatives
|
|
||||||
Array) definiert die Anzahl der von <emphasis>foreach</emphasis> zu
|
|
||||||
durchlaufenen Iterationen. <emphasis>foreachelse</emphasis> wird
|
|
||||||
ausgef<65>hrt wenn keine Werte in der <emphasis>from</emphasis>
|
|
||||||
Variable <20>bergeben wurden.
|
|
||||||
</para>
|
|
||||||
<example>
|
<example>
|
||||||
<title>{foreach} - item</title>
|
<title>{foreach} - item</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
|
@@ -1,18 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.5 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.8 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.if">
|
<sect1 id="language.function.if">
|
||||||
<title>if,elseif,else</title>
|
<title>{if},{elseif},{else}</title>
|
||||||
<para>
|
<para>
|
||||||
<emphasis>{if}</emphasis>-Statements in Smarty erlauben die selbe
|
<emphasis>{if}</emphasis>-Statements in Smarty erlauben die selbe
|
||||||
Flexibilit<69>t wie in PHP, bis auf ein paar Erweiterungen f<>r die
|
Flexibilit<69>t wie in PHP, bis auf ein paar Erweiterungen f<>r die
|
||||||
Template-Engine. Jedes <emphasis>{if}</emphasis> muss mit einem
|
Template-Engine. Jedes <emphasis>{if}</emphasis> muss mit einem
|
||||||
<emphasis>{/if}</emphasis> kombiniert
|
<emphasis>{/if}</emphasis> kombiniert
|
||||||
sein. <emphasis>{else}</emphasis> und <emphasis>{elseif}</emphasis>
|
sein. <emphasis>{else}</emphasis> und <emphasis>{elseif}</emphasis>
|
||||||
sind ebenfalls erlaubt. Alle PHP Vergleichsoperatoren, wie
|
sind ebenfalls erlaubt. Alle PHP Vergleichsoperatoren und Funktionen, wie
|
||||||
<emphasis>||</emphasis>, <emphasis>or</emphasis>,
|
<emphasis>||</emphasis>, <emphasis>or</emphasis>,
|
||||||
<emphasis>&&</emphasis>, <emphasis>and</emphasis>, etc. sind
|
<emphasis>&&</emphasis>, <emphasis>and</emphasis>,
|
||||||
erlaubt.
|
<emphasis>is_array()</emphasis>, etc. sind erlaubt.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Wenn <link linkend="variable.security">$security</link> angeschaltet
|
||||||
|
wurde, dann m<>ssen alle verwendeten PHP-Funktionen im
|
||||||
|
<emphasis>IF_FUNCS</emphasis>-Array in dem <link
|
||||||
|
linkend="variable.security.settings">$security_settings</link>-Array
|
||||||
|
deklariert werden.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Hier eine Liste der erlaubten Operatoren. Bedingungsoperatoren
|
Hier eine Liste der erlaubten Operatoren. Bedingungsoperatoren
|
||||||
@@ -160,14 +167,15 @@
|
|||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{* die foldende Syntax ist nicht korrekt, da die Elemente welche die
|
{*
|
||||||
Bedingung umfassen nicht mit Leerzeichen abgetrennt sind*}
|
die foldende Syntax ist nicht korrekt, da die Elemente welche die
|
||||||
|
Bedingung umfassen nicht mit Leerzeichen abgetrennt sind
|
||||||
|
*}
|
||||||
{if $name=="Fred" || $name=="Wilma"}
|
{if $name=="Fred" || $name=="Wilma"}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{* Klammern sind erlaubt *}
|
{* Klammern sind erlaubt *}
|
||||||
{if ( $anzahl < 0 or $anzahl > 1000 ) and $menge >= #minMengeAmt#}
|
{if ( $anzahl < 0 or $anzahl > 1000 ) and $menge >= #minMengeAmt#}
|
||||||
...
|
...
|
||||||
@@ -179,6 +187,17 @@
|
|||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{* Auf "ist array" <20>berpr<70>fen. *}
|
||||||
|
{if is_array($foo) }
|
||||||
|
.....
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{* Auf "ist nicht null" <20>berpr<70>fen. *}
|
||||||
|
{if isset($foo) }
|
||||||
|
.....
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{* testen ob eine Zahl gerade (even) oder ungerade (odd) ist *}
|
{* testen ob eine Zahl gerade (even) oder ungerade (odd) ist *}
|
||||||
{if $var is even}
|
{if $var is even}
|
||||||
|
@@ -1,8 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.8 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.9 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.include.php">
|
<sect1 id="language.function.include.php">
|
||||||
<title>include_php (PHP-Code einbinden)</title>
|
<title>include_php (PHP-Code einbinden)</title>
|
||||||
|
<para>
|
||||||
|
Die Verwendung von {include_php} wird nicht mehr empfohlen, die
|
||||||
|
gleiche funktionalit<69>t kann auch mit <link
|
||||||
|
linkend="tips.componentized.templates">Template/Script
|
||||||
|
Komponenten</link> erreicht werden.
|
||||||
|
</para>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -44,12 +50,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
Die Verwendung von {include_php} wird nicht mehr empfohlen, die
|
|
||||||
gleiche funktionalit<69>t kann auch mit <link
|
|
||||||
linkend="tips.componentized.templates">Template/Script
|
|
||||||
Komponenten</link> erreicht werden.
|
|
||||||
</para>
|
|
||||||
<para>
|
<para>
|
||||||
Falls <link linkend="variable.security">Sicherheit</link> aktiviert
|
Falls <link linkend="variable.security">Sicherheit</link> aktiviert
|
||||||
ist, muss das einzubindende Skript im <link
|
ist, muss das einzubindende Skript im <link
|
||||||
|
@@ -1,8 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.8 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.9 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.include">
|
<sect1 id="language.function.include">
|
||||||
<title>include (einbinden)</title>
|
<title>include (einbinden)</title>
|
||||||
|
<para>
|
||||||
|
{include}-Tags werden verwendet, um andere Templates in das aktuelle
|
||||||
|
Template einzubinden. Alle Variablen des aktuellen Templates sind
|
||||||
|
auch im eingebundenen Template verf<72>gbar. Das {include}-Tag muss ein
|
||||||
|
'file' Attribut mit dem Pfad zum einzubindenden Template enthalten.
|
||||||
|
</para>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -44,12 +50,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
Include Tags werden verwendet, um andere Templates in das aktuelle
|
|
||||||
Template einzubinden. Alle Variablen des aktuellen Templates sind
|
|
||||||
auch im eingebundenen Template verf<72>gbar. Das include-Tag muss ein
|
|
||||||
'file' Attribut mit dem Pfad zum einzubindenden Template enthalten.
|
|
||||||
</para>
|
|
||||||
<para>
|
<para>
|
||||||
Optional kann mit dem <emphasis>assign</emphasis> Attribut definiert
|
Optional kann mit dem <emphasis>assign</emphasis> Attribut definiert
|
||||||
werden, in welcher Variable die Ausgabe des mit
|
werden, in welcher Variable die Ausgabe des mit
|
||||||
@@ -65,12 +65,12 @@
|
|||||||
<title>{$title}</title>
|
<title>{$title}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{include file="page_header.tpl"}
|
{include file='page_header.tpl'}
|
||||||
|
|
||||||
{* hier kommt der body des Templates *}
|
{* hier kommt der body des Templates *}
|
||||||
{include file="/$tpl_name.tpl"} <-- $tpl_name wird durch eine Wert ersetzt
|
{include file="$tpl_name.tpl"} <-- $tpl_name wird durch eine Wert ersetzt
|
||||||
|
|
||||||
{include file="page_footer.tpl"}
|
{include file='page_footer.tpl'}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
]]>
|
]]>
|
||||||
@@ -87,11 +87,11 @@
|
|||||||
<title>include-Funktion und Variablen <20>bergabe</title>
|
<title>include-Funktion und Variablen <20>bergabe</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{include file="header.tpl" title="Hauptmenu" table_bgcolor="#c0c0c0"}
|
{include file='header.tpl' title='Hauptmenu' table_bgcolor='#c0c0c0'}
|
||||||
|
|
||||||
{* hier kommt der body des Templates *}
|
{* hier kommt der body des Templates *}
|
||||||
|
|
||||||
{include file="footer.tpl" logo="http://my.domain.com/logo.gif"}
|
{include file='footer.tpl' logo='http://my.domain.com/logo.gif'}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
@@ -105,16 +105,24 @@
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* absoluter Dateipfad *}
|
{* absoluter Dateipfad *}
|
||||||
{include file="/usr/local/include/templates/header.tpl"}
|
{include file='/usr/local/include/templates/header.tpl'}
|
||||||
|
|
||||||
{* absoluter Dateipfad (gleich) *}
|
{* absoluter Dateipfad (gleich) *}
|
||||||
{include file="file:/usr/local/include/templates/header.tpl"}
|
{include file='file:/usr/local/include/templates/header.tpl'}
|
||||||
|
|
||||||
{* absoluter Dateipfad unter Windows ("file:"-Prefix MUSS <20>bergeben werden) *}
|
{* absoluter Dateipfad unter Windows ("file:"-Prefix MUSS <20>bergeben werden) *}
|
||||||
{include file="file:C:/www/pub/templates/header.tpl"}
|
{include file='file:C:/www/pub/templates/header.tpl'}
|
||||||
|
|
||||||
{* einbinden aus Template-Ressource namens 'db' *}
|
{* einbinden aus Template-Ressource namens 'db' *}
|
||||||
{include file="db:header.tpl"}
|
{include file='db:header.tpl'}
|
||||||
|
|
||||||
|
{* einbinden eines Variablen Templates - z.B. $module = 'contacts' *}
|
||||||
|
{include file="$module.tpl"}
|
||||||
|
{*
|
||||||
|
Dies hier Funktioniert nicht, da Variablen innerhalb einfacher
|
||||||
|
Anf<6E>hrungszeichen nicht interpoliert werden.
|
||||||
|
*}
|
||||||
|
{include file='$module.tpl'}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
@@ -3,6 +3,13 @@
|
|||||||
<!-- EN-Revision: 1.5 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.5 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.insert">
|
<sect1 id="language.function.insert">
|
||||||
<title>insert (einf<6E>gen)</title>
|
<title>insert (einf<6E>gen)</title>
|
||||||
|
<para>
|
||||||
|
{insert}-Tags funktionieren <20>hnlich den <link
|
||||||
|
linkend="language.function.include">{include}</link>-Tags, werden
|
||||||
|
aber nicht gecached, falls <link linkend="caching">caching</link>
|
||||||
|
eingeschaltet ist. Sie werden bei jedem Aufruf des Templates
|
||||||
|
ausgef<65>hrt.
|
||||||
|
</para>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -51,13 +58,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
{insert}-Tags funktionieren <20>hnlich den <link
|
|
||||||
linkend="language.function.include">{include}</link>-Tags, werden
|
|
||||||
aber nicht gecached, falls <link linkend="caching">caching</link>
|
|
||||||
eingeschaltet ist. Sie werden bei jedem Aufruf des Templates
|
|
||||||
ausgef<65>hrt.
|
|
||||||
</para>
|
|
||||||
<para>
|
<para>
|
||||||
Stellen Sie sich vor, sie h<>tten ein Template mit einem
|
Stellen Sie sich vor, sie h<>tten ein Template mit einem
|
||||||
Werbebanner. Dieser Banner kann verschiedene Arten von Inhalten
|
Werbebanner. Dieser Banner kann verschiedene Arten von Inhalten
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.6 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.7 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.php">
|
<sect1 id="language.function.php">
|
||||||
<title>php</title>
|
<title>php</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
{php}
|
{php}
|
||||||
// php Skript direkt von Template einbinden
|
// php Skript direkt von Template einbinden
|
||||||
include("/pfad/zu/zeige_weather.php");
|
include('/pfad/zu/zeige_weather.php');
|
||||||
{/php}
|
{/php}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -31,6 +31,19 @@
|
|||||||
im Kontext der method des laufenden $smarty-Objektes.
|
im Kontext der method des laufenden $smarty-Objektes.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
<example>
|
||||||
|
<title>{php} mit Verwendung von global</title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
{php}
|
||||||
|
global $foo, $bar;
|
||||||
|
if($foo == $bar){
|
||||||
|
// tue irgendwas
|
||||||
|
}
|
||||||
|
{/php}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Siehe auch <link
|
Siehe auch <link
|
||||||
linkend="variable.php.handling">$php_handling</link>, <link
|
linkend="variable.php.handling">$php_handling</link>, <link
|
||||||
|
@@ -1,8 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.13 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.14 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.section">
|
<sect1 id="language.function.section">
|
||||||
<title>section,sectionelse</title>
|
<title>section,sectionelse</title>
|
||||||
|
<para>
|
||||||
|
Template-{sections} werden verwendet, um durch <emphasis
|
||||||
|
role="bold">Arrays</emphasis> zu iterieren (<28>hnlich wie <link
|
||||||
|
linkend="language.function.foreach">{foreach}</link>). Jedes
|
||||||
|
<emphasis>section</emphasis>-Tag muss mit einem
|
||||||
|
<emphasis>/section</emphasis>-Tag kombiniert
|
||||||
|
werden. <emphasis>name</emphasis> und <emphasis>loop</emphasis> sind
|
||||||
|
erforderliche Parameter. Der Name der 'section' kann frei gew<65>hlt
|
||||||
|
werden, muss jedoch aus Buchstaben, Zahlen oder Unterstrichen
|
||||||
|
bestehen. {sections} k<>nnen verschachtelt werden. Dabei ist zu
|
||||||
|
beachten, dass sich ihre Namen unterscheiden. Aus der
|
||||||
|
'loop'-Variable (normalerweise ein Array von Werten) resultiert die
|
||||||
|
Anzahl der Iterationen, die durchlaufen werden. Wenn ein Wert aus
|
||||||
|
der 'loop'-Variable innerhalb der {section} ausgegeben werden soll,
|
||||||
|
muss der 'section-name' umschlossen mit [] angef<65>gt werden.
|
||||||
|
<emphasis>sectionelse</emphasis> wird ausgef<65>hrt, wenn keine Werte
|
||||||
|
in der 'loop'-Variable enthalten sind.
|
||||||
|
</para>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -76,24 +94,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
Template-{sections} werden verwendet, um durch <emphasis
|
|
||||||
role="bold">Arrays</emphasis> zu iterieren (<28>hnlich wie <link
|
|
||||||
linkend="language.function.foreach">{foreach}</link>). Jedes
|
|
||||||
<emphasis>section</emphasis>-Tag muss mit einem
|
|
||||||
<emphasis>/section</emphasis>-Tag kombiniert
|
|
||||||
werden. <emphasis>name</emphasis> und <emphasis>loop</emphasis> sind
|
|
||||||
erforderliche Parameter. Der Name der 'section' kann frei gew<65>hlt
|
|
||||||
werden, muss jedoch aus Buchstaben, Zahlen oder Unterstrichen
|
|
||||||
bestehen. {sections} k<>nnen verschachtelt werden. Dabei ist zu
|
|
||||||
beachten, dass sich ihre Namen unterscheiden. Aus der
|
|
||||||
'loop'-Variable (normalerweise ein Array von Werten) resultiert die
|
|
||||||
Anzahl der Iterationen, die durchlaufen werden. Wenn ein Wert aus
|
|
||||||
der 'loop'-Variable innerhalb der {section} ausgegeben werden soll,
|
|
||||||
muss der 'section-name' umschlossen mit [] angef<65>gt werden.
|
|
||||||
<emphasis>sectionelse</emphasis> wird ausgef<65>hrt, wenn keine Werte
|
|
||||||
in der 'loop'-Variable enthalten sind.
|
|
||||||
</para>
|
|
||||||
<example>
|
<example>
|
||||||
<title>section</title>
|
<title>section</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.6 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.8 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.function.strip">
|
<sect1 id="language.function.strip">
|
||||||
<title>strip</title>
|
<title>strip</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<table border=0>
|
<table border=0>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a HREF="{$url}">
|
<a href="{$url}">
|
||||||
<font color="red">Das ist ein Test.</font>
|
<font color="red">Das ist ein Test.</font>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<table border=0><tr><td><A HREF="http://my.domain.com"><font color="red">Das ist ein Test.</font></A></td></tr></table>
|
<table border=0><tr><td><a href="http://my.domain.com"><font color="red">Das ist ein Test.</font></a></td></tr></table>
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
@@ -1,84 +1,183 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<!-- EN-Revision: 1.1 Maintainer: andreas Status: ready -->
|
<!-- EN-Revision: 1.7 Maintainer: andreas Status: ready -->
|
||||||
<sect1 id="language.assigned.variables">
|
<sect1 id="language.assigned.variables">
|
||||||
<title>Aus einem PHP-Skript zugewiesene Variablen</title>
|
<title>Aus einem PHP-Skript zugewiesene Variablen</title>
|
||||||
<para>
|
<para>
|
||||||
Variablen die in einem PHP Skript zugewiesen wurden, müssen mit eine Dollar Zeichen <literal>$</literal>
|
Variablen die in einem PHP Skript <link
|
||||||
versehen werden.
|
linkend="api.assign">assigned</link> mit zugewiesen wurden, m<>ssen
|
||||||
</para>
|
mit eine Dollar Zeichen <literal>$</literal> versehen werden. Auf
|
||||||
<example>
|
die gleiche Art werden Variablen ausgegeben, die im Template mit <link
|
||||||
|
linkend="language.function.assign">{assign}</link> zugewiesen
|
||||||
|
wurden.
|
||||||
|
</para>
|
||||||
|
<example>
|
||||||
|
<title>zugewiesene Variablen</title>
|
||||||
|
<para>PHP-Skript</para>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
<title>zugewiesene Variablen</title>
|
$smarty = new Smarty;
|
||||||
<programlisting>
|
|
||||||
Hallo {$vorname}, schön dass Du wieder da bist.
|
|
||||||
<p>
|
|
||||||
Letzer zugriff: {$lastLoginDate}.
|
|
||||||
|
|
||||||
AUSGABE:
|
$smarty->assign('vorname', 'Andreas');
|
||||||
|
$smarty->assign('nachname', 'Halter');
|
||||||
|
$smarty->assign('treffpunkt', 'New York');
|
||||||
|
|
||||||
Hallo Andreas, schön dass Du wieder da bist.
|
$smarty->display('index.tpl');
|
||||||
<p>
|
|
||||||
Letzer Zugriff: January 11th, 2001.</programlisting>
|
|
||||||
</example>
|
|
||||||
|
|
||||||
<sect2 id="language.variables.assoc.arrays">
|
?>
|
||||||
<title>Assoziative Arrays</title>
|
]]>
|
||||||
<para>
|
</programlisting>
|
||||||
Sie können auch auf die Werte eines in PHP zugewiesenen assoziativen Arrays zugreifen,
|
<para>
|
||||||
indem Sie den Schlüssel nach einem '.'-Zeichen (Punkt) notieren.
|
Mit folgendem index.tpl:
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<programlisting>
|
||||||
<title>Zugriff auf Variablen eines assoziativen Arrays</title>
|
<![CDATA[
|
||||||
<programlisting>
|
Hallo {$vorname} {$nachname}, sch<63>n, dass Du es einrichten kannst.
|
||||||
{$Kontakte.fax}<br>
|
<br />
|
||||||
{$Kontakte.email}<br>
|
{*
|
||||||
{* auch multidimensionale Arrays können so angesprochen werden *}
|
das hier funktioniert nicht, da bei Variablennamen auf
|
||||||
{$Kontakte.telefon.privat}<br>
|
Gross-Kleinschreibung geachtet werden muss:
|
||||||
{$Kontakte.telefon.mobil}<br>
|
*}
|
||||||
|
Diese Woche findet das Treffen in {$treffPunkt} statt.
|
||||||
|
|
||||||
AUSGABE:
|
{* aber das hier funktioniert: *}
|
||||||
|
Diese Woche findet das Treffen in {$treffpunkt} statt.
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Ausgabe:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Hallo Andreas Halter, sch<63>n, dass Du es einrichten kannst.
|
||||||
|
<br />
|
||||||
|
Diese Woche findet das Treffen in statt.
|
||||||
|
Diese Woche findet das Treffen in New York statt.
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</example>
|
||||||
|
<sect2 id="language.variables.assoc.arrays">
|
||||||
|
<title>Assoziative Arrays</title>
|
||||||
|
<para>
|
||||||
|
Sie k<>nnen auch auf die Werte eines in PHP zugewiesenen
|
||||||
|
assoziativen Arrays zugreifen, indem Sie den Schl<68>ssel (Indexwert)
|
||||||
|
nach einem '.'-Zeichen (Punkt) notieren.
|
||||||
|
</para>
|
||||||
|
<example>
|
||||||
|
<title>Zugriff auf Variablen eines assoziativen Arrays</title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
$smarty->assign('kontakte',
|
||||||
|
array('fax' => '555-222-9876',
|
||||||
|
'email' => 'zaphod@slartibartfast.example.com',
|
||||||
|
'telefon' => array('privat' => '555-444-3333',
|
||||||
|
'mobil' => '555-111-1234')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$smarty->display('index.tpl');
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Bei folgender index.tpl:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
{$kontakte.fax}<br />
|
||||||
|
{$kontakte.email}<br />
|
||||||
|
{* auch multidimensionale Arrays k<>nnen so angesprochen werden *}
|
||||||
|
{$kontakte.telefon.privat}<br />
|
||||||
|
{$kontakte.telefon.mobil}<br />
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Ausgabe:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
555-222-9876<br />
|
||||||
|
zaphod@slartibartfast.example.com<br />
|
||||||
|
555-444-3333<br />
|
||||||
|
555-111-1234<br />
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</example>
|
||||||
|
</sect2>
|
||||||
|
<sect2 id="language.variables.array.indexes">
|
||||||
|
<title>Array Index</title>
|
||||||
|
<para>
|
||||||
|
Arrays k<>nnen - <20>hnlich der PHP-Syntax - auch <20>ber ihren Index
|
||||||
|
angesprochen werden.
|
||||||
|
</para>
|
||||||
|
<example>
|
||||||
|
<title>Zugriff <20>ber den Array Index</title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
$smarty->assign('kontakte', array(
|
||||||
|
'555-222-9876',
|
||||||
|
'zaphod@slartibartfast.example.com',
|
||||||
|
array('555-444-3333',
|
||||||
|
'555-111-1234')
|
||||||
|
));
|
||||||
|
$smarty->display('index.tpl');
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Bei folgendem index.tpl:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
{$kontakte[0]}<br />
|
||||||
|
{$kontakte[1]}<br />
|
||||||
|
{* auch hier sind multidimensionale Arrays m<>glich *}
|
||||||
|
{$kontakte[0][0]}<br />
|
||||||
|
{$kontakte[0][1]}<br />
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Ausgabe:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
555-222-9876<br />
|
||||||
|
zaphod@slartibartfast.example.com<br />
|
||||||
|
555-444-3333<br />
|
||||||
|
555-111-1234<br />
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</example>
|
||||||
|
</sect2>
|
||||||
|
|
||||||
555-222-9876<br>
|
<sect2 id="language.variables.objects">
|
||||||
zaphod@slartibartfast.com<br>
|
<title>Objekte</title>
|
||||||
555-444-3333<br>
|
<para>
|
||||||
555-111-1234<br>
|
Attribute von aus PHP zugewiesenen Objekten k<>nnen <20>ber
|
||||||
</programlisting>
|
das '->'-Symbol erreicht werden.
|
||||||
</example>
|
</para>
|
||||||
</sect2>
|
<example>
|
||||||
<sect2 id="language.variables.array.indexes">
|
<title>Zugriff auf Objekt-Attribute</title>
|
||||||
<title>Array Index</title>
|
<programlisting>
|
||||||
<para>
|
<![CDATA[
|
||||||
Arrays können - ähnlich der PHP-Syntax - auch über ihren Index angesprochen werden.
|
name: {$person->name}<br />
|
||||||
</para>
|
email: {$person->email}<br />
|
||||||
<example>
|
]]>
|
||||||
<title>Zugriff über den Array Index</title>
|
</programlisting>
|
||||||
<programlisting>
|
<para>
|
||||||
{$Kontakte[0]}<br>
|
Ausgabe:
|
||||||
{$Kontakte[1]}<br>
|
</para>
|
||||||
{* auch hier sind multidimensionale Arrays möglich *}
|
<screen>
|
||||||
{$Kontakte[0][0]}<br>
|
<![CDATA[
|
||||||
{$Kontakte[0][1]}<br></programlisting>
|
name: Zaphod Beeblebrox<br />
|
||||||
</example>
|
email: zaphod@slartibartfast.example.com<br />
|
||||||
</sect2>
|
]]>
|
||||||
<sect2 id="language.variables.objects">
|
</screen>
|
||||||
<title>Objekte</title>
|
</example>
|
||||||
<para>
|
</sect2>
|
||||||
Attribute von aus PHP zugewiesenen Objekten können
|
|
||||||
über das '->'-Symbol erreicht werden.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Zugriff auf Objekt-Attribute</title>
|
|
||||||
<programlisting>
|
|
||||||
name: {$person->name}<br>
|
|
||||||
email: {$person->email}<br>
|
|
||||||
|
|
||||||
AUSGABE:
|
|
||||||
|
|
||||||
name: Zaphod Beeblebrox<br>
|
|
||||||
email: zaphod@slartibartfast.com<br></programlisting>
|
|
||||||
</example>
|
|
||||||
</sect2>
|
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
Reference in New Issue
Block a user