2004-05-23 15:39:02 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<!-- $Revision$ -->
|
2006-09-30 15:12:18 +00:00
|
|
|
|
<!-- EN-Revision: 1.14 Maintainer: gerald Status: ready -->
|
2005-12-01 20:28:15 +00:00
|
|
|
|
|
2004-05-23 15:44:59 +00:00
|
|
|
|
<sect1 id="language.function.capture">
|
2005-05-26 18:10:32 +00:00
|
|
|
|
<title>{capture}</title>
|
2005-12-01 20:28:15 +00:00
|
|
|
|
|
|
|
|
|
|
<para>
|
2006-09-30 15:12:18 +00:00
|
|
|
|
<varname>{capture}</varname> est utilis<69> pour r<>cup<75>rer la sortie d'<27>l<EFBFBD>ments dans
|
|
|
|
|
|
une variable au lieu de les afficher. Tout contenu situ<74> entre
|
|
|
|
|
|
<varname>{capture name='foo'}</varname> et <varname>{/capture}</varname>
|
|
|
|
|
|
est intercept<70> dans une variable dont le nom est sp<73>cifi<66> dans l'attribut
|
|
|
|
|
|
<parameter>name</parameter>.
|
2006-04-09 21:59:55 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Le contenu captur<75> peut <20>tre utilis<69> dans
|
2005-12-01 20:28:15 +00:00
|
|
|
|
le template par l'interm<72>diaire de la variable sp<73>ciale
|
2006-09-30 15:12:18 +00:00
|
|
|
|
<link linkend="language.variables.smarty.capture"><parameter>$smarty.capture.foo</parameter></link>
|
|
|
|
|
|
o<> <quote>foo</quote> est la valeur de l'attribut <parameter>name</parameter>.
|
|
|
|
|
|
Si vous ne donnez pas de valeur <20> l'attribut <parameter>name</parameter>, alors
|
|
|
|
|
|
<quote>default</quote> est utilis<69> en tant que nom, i.e.
|
|
|
|
|
|
<parameter>$smarty.capture.default</parameter>.
|
2006-04-09 21:59:55 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
2006-09-30 15:12:18 +00:00
|
|
|
|
<varname>{capture}</varname> peut <20>tre imbriqu<71>.
|
2005-12-01 20:28:15 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
|
2005-05-24 20:46:11 +00:00
|
|
|
|
<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</entry>
|
|
|
|
|
|
<entry>Type</entry>
|
|
|
|
|
|
<entry>Requis</entry>
|
|
|
|
|
|
<entry>Defaut</entry>
|
|
|
|
|
|
<entry>Description</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>name</entry>
|
|
|
|
|
|
<entry>string</entry>
|
|
|
|
|
|
<entry>non</entry>
|
|
|
|
|
|
<entry><emphasis>default</emphasis></entry>
|
|
|
|
|
|
<entry>Le nom du bloc captur<75></entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>assign</entry>
|
|
|
|
|
|
<entry>string</entry>
|
|
|
|
|
|
<entry>non</entry>
|
|
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
|
|
|
|
<entry>Le nom de la variable <20> laquelle la sortie sera assign<67>e</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</tgroup>
|
|
|
|
|
|
</informaltable>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
<caution>
|
2004-05-23 13:49:44 +00:00
|
|
|
|
<para>
|
2006-09-30 15:12:18 +00:00
|
|
|
|
Fa<46>tes attention lorsque vous interceptez la sortie de commandes
|
|
|
|
|
|
<link linkend="language.function.insert"><varname>{insert}</varname></link>.
|
2005-05-24 20:46:11 +00:00
|
|
|
|
Si vous avez configur<75> le <link linkend="caching">cache</link> pour que ce
|
2005-05-26 18:10:32 +00:00
|
|
|
|
dernier soit actif, et que vous avez des commandes <link
|
2006-09-30 15:12:18 +00:00
|
|
|
|
linkend="language.function.insert"><varname>{insert}</varname></link>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
suppos<6F>es s'ex<65>cuter dans un contenu en cache, ne tentez pas de capturer
|
|
|
|
|
|
ce contenu.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</caution>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
<example>
|
2006-04-09 21:59:55 +00:00
|
|
|
|
<title>{capture} avec le nom de l'attribut</title>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
<programlisting>
|
2004-05-23 13:49:44 +00:00
|
|
|
|
<![CDATA[
|
2006-04-09 21:59:55 +00:00
|
|
|
|
{* nous ne voulons afficher une balise div que si le contenu est affich<63>. *}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{capture name=banner}
|
2005-12-01 20:28:15 +00:00
|
|
|
|
{include file='get_banner.tpl'}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{/capture}
|
|
|
|
|
|
{if $smarty.capture.banner ne ""}
|
2006-04-09 21:59:55 +00:00
|
|
|
|
<div id="banner">{$smarty.capture.banner}</div>
|
2004-05-23 13:49:44 +00:00
|
|
|
|
{/if}
|
|
|
|
|
|
]]>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</programlisting>
|
|
|
|
|
|
</example>
|
2005-12-01 20:28:15 +00:00
|
|
|
|
|
|
|
|
|
|
<example>
|
2006-04-09 21:59:55 +00:00
|
|
|
|
<title>{capture} dans une variable de template</title>
|
2005-12-01 20:28:15 +00:00
|
|
|
|
<para>Cet exemple d<>montre <20>galement la fonction
|
2006-09-30 15:12:18 +00:00
|
|
|
|
<link linkend="language.function.popup"><varname>{popup}</varname></link>
|
2005-12-01 20:28:15 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
{capture name=some_content assign=popText}
|
2006-04-09 21:59:55 +00:00
|
|
|
|
Le serveur est {$smarty.server.SERVER_NAME|upper} sur {$smarty.server.SERVER_ADDR}<br>
|
|
|
|
|
|
Votre IP est {$smarty.server.REMOTE_ADDR}.
|
2005-12-01 20:28:15 +00:00
|
|
|
|
{/capture}
|
2006-04-09 21:59:55 +00:00
|
|
|
|
<a href="#" {popup caption='Information sur le serveur' text=$popText}>Aide</a>
|
2005-12-01 20:28:15 +00:00
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
</example>
|
|
|
|
|
|
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</para>
|
2005-05-24 20:46:11 +00:00
|
|
|
|
<para>
|
2005-09-03 08:53:14 +00:00
|
|
|
|
Voir aussi
|
2006-09-30 15:12:18 +00:00
|
|
|
|
<link linkend="language.variables.smarty.capture"><parameter>$smarty.capture</parameter></link>,
|
|
|
|
|
|
<link linkend="language.function.eval"><varname>{eval}</varname></link>,
|
|
|
|
|
|
<link linkend="language.function.fetch"><varname>{fetch}</varname></link>,
|
|
|
|
|
|
<link linkend="api.fetch"><varname>fetch()</varname></link> et
|
|
|
|
|
|
<link linkend="language.function.assign"><varname>{assign}</varname></link>.
|
2005-05-24 20:46:11 +00:00
|
|
|
|
</para>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</sect1>
|
2005-05-24 20:46:11 +00:00
|
|
|
|
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<!-- 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
|
2005-05-24 20:46:11 +00:00
|
|
|
|
-->
|