Files
smarty/docs/de/designers/language-builtin-functions/language-function-capture.xml
2005-12-09 19:50:41 +00:00

130 lines
3.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1.10 Maintainer: andreas Status: ready -->
<sect1 id="language.function.capture">
<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 über <link
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
angesprochen werden. Falls kein 'name'-Attribut übergeben wurde,
wird der Inhalt in 'default' (also $smarty.capture.default)
abgelegt. Jede {capture} Sektion muss mit {/capture} beendet
werden. {capture}-Blöcke können verschachtelt sein.
</para>
<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>Benötigt</entry>
<entry>Standardwert</entry>
<entry>Beschreibung</entry>
</row>
</thead>
<tbody>
<row>
<entry>name</entry>
<entry>string</entry>
<entry>no</entry>
<entry><emphasis>default</emphasis></entry>
<entry>Der Name des abgefangenen Blocks</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>Der Name der Variable welcher der Wert zugewiesen werden soll.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<caution>
<para>
Seien Sie vorsichtig, wenn sie die Ausgabe von <link
linkend="language.function.insert">{insert}</link> abfangen
wollen. Sie sollten die Ausgabe nicht abfangen, wenn Caching
eingeschaltet ist und Sie einen <link
linkend="language.function.insert">{insert}</link> Befehl
verwenden, um Ausgaben vom Caching auszuschliessen.
</para>
</caution>
<para>
<example>
<title>Template-Inhalte abfangen</title>
<programlisting>
<![CDATA[
{* Tabellenzeile nur ausgeben, wenn Inhalt vorhanden *}
{capture name=banner}
{include file='get_banner.tpl'}
{/capture}
{if $smarty.capture.banner ne ""}
<table>
<tr>
<td>
{$smarty.capture.banner}
</td>
</tr>
</table>
{/if}
]]>
</programlisting>
</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>
</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
-->