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,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.3 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.clear.config">
|
||||
<refnamediv>
|
||||
<refname>clear_config</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>clear_config()</refname>
|
||||
<refpurpose>Efface toutes les variables de configuration assign<67>es</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_config</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>var</parameter></methodparam>
|
||||
@@ -18,7 +19,7 @@
|
||||
Si un nom de variable est sp<73>cifi<66>, seule cette variable sera effac<61>e.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemple avec clear_config</title>
|
||||
<title>Exemple avec clear_config()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -33,6 +34,7 @@ $smarty->clear_config('foobar');
|
||||
</example>
|
||||
<para>
|
||||
Voir aussi les
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>,
|
||||
<link linkend="language.config.variables">variables de configuration</link>,
|
||||
<link linkend="config.files">config files</link>,
|
||||
<link linkend="language.function.config.load">{config_load}</link>,
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.3 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.config.load">
|
||||
<refnamediv>
|
||||
<refname>config_load</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>config_load()</refname>
|
||||
<refpurpose>Charge les donn<6E>es d'un fichier de configuration et les assigne au template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>config_load</methodname>
|
||||
<methodparam><type>string</type><parameter>file</parameter></methodparam>
|
||||
@@ -34,7 +35,7 @@
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>Exemple avec config_load</title>
|
||||
<title>Exemple avec config_load()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -50,11 +51,13 @@ $smarty->config_load('my.conf','foobar');
|
||||
<para>
|
||||
Voir aussi
|
||||
<link linkend="language.function.config.load">{config_load}</link>,
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>,
|
||||
<link linkend="api.clear.config">clear_config()</link> et les
|
||||
<link linkend="language.config.variables">variables de configuration</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
@@ -74,4 +77,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
@@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.5 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.display">
|
||||
<refnamediv>
|
||||
<refname>display</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>display()</refname>
|
||||
<refpurpose>Affiche le template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>display</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter>
|
||||
</methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Utilis<69>e pour afficher un template. Il faut fournir un type et un
|
||||
@@ -24,7 +26,7 @@
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
<example>
|
||||
<title>Exemple avec display</title>
|
||||
<title>Exemple avec display()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -60,7 +62,7 @@ $smarty->display("index.tpl");
|
||||
Utilisez la syntaxe des <link
|
||||
linkend="template.resources">ressources templates</link>
|
||||
pour afficher des fichiers en-dehors du r<>pertoire
|
||||
$template_dir.
|
||||
<link linkend="variable.template.dir">$template_dir</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemples de fonction d'affichage de ressources templates</title>
|
||||
@@ -68,16 +70,16 @@ $smarty->display("index.tpl");
|
||||
<![CDATA[
|
||||
<?php
|
||||
// chemin absolu
|
||||
$smarty->display("/usr/local/include/templates/header.tpl");
|
||||
$smarty->display('/usr/local/include/templates/header.tpl');
|
||||
|
||||
// chemin absolu (m<>m chose)
|
||||
$smarty->display("file:/usr/local/include/templates/header.tpl");
|
||||
$smarty->display('file:/usr/local/include/templates/header.tpl');
|
||||
|
||||
// chemin absolu Windows (on DOIT utiliser le pr<70>fixe "file:")
|
||||
$smarty->display("file:C:/www/pub/templates/header.tpl");
|
||||
$smarty->display('file:C:/www/pub/templates/header.tpl');
|
||||
|
||||
// inclue <20> partir de la ressource template nomm<6D>e "db"
|
||||
$smarty->display("db:header.tpl");
|
||||
$smarty->display('db:header.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@@ -1,21 +1,24 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.5 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.7 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.fetch">
|
||||
<refnamediv>
|
||||
<refname>fetch</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>fetch()</refname>
|
||||
<refpurpose>Retourne le r<>sultat du template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>fetch</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>$compile_id</parameter>
|
||||
</methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Utilis<69>e pour renvoyer le r<>sultat du template plut<75>t que de l'afficher.
|
||||
Utilis<69>e pour renvoyer le r<>sultat du template plut<75>t que de
|
||||
l'<link linkend="api.display">afficher</link>.
|
||||
Il faut passer un type et un chemin de <link
|
||||
linkend="template.resources">ressource template</link>
|
||||
valides. Vous pouvez passer un identifiant de cache en deuxi<78>me
|
||||
@@ -23,38 +26,39 @@
|
||||
</link> pour plus de renseignements.
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
|
||||
<para>
|
||||
<example>
|
||||
<title>Exemple avec fetch</title>
|
||||
<title>Exemple avec fetch()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
include("Smarty.class.php");
|
||||
include('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->caching = true;
|
||||
|
||||
// ne fait un appel <20> la base de donn<6E>es que si le fichier
|
||||
// de cache n'existe pas
|
||||
if(!$smarty->is_cached("index.tpl"))
|
||||
if(!$smarty->is_cached('index.tpl'))
|
||||
{
|
||||
|
||||
// quelques donn<6E>es
|
||||
$address = "245 N 50th";
|
||||
$address = '245 N 50th';
|
||||
$db_data = array(
|
||||
"Ville" => "Lincoln",
|
||||
"Pays" => "Nebraska",
|
||||
"Code postal" = > "68502"
|
||||
'Ville' => 'Lincoln',
|
||||
'Pays' => 'Nebraska',
|
||||
'Code postal' = > '68502'
|
||||
);
|
||||
|
||||
$smarty->assign("Nom","Fred");
|
||||
$smarty->assign("Adresse",$address);
|
||||
$smarty->assign('Nom','Fred');
|
||||
$smarty->assign('Adresse',$address);
|
||||
$smarty->assign($db_data);
|
||||
|
||||
}
|
||||
|
||||
// r<>cup<75>re le r<>sultat
|
||||
$output = $smarty->fetch("index.tpl");
|
||||
$output = $smarty->fetch('index.tpl');
|
||||
|
||||
// fait quelque chose avec $output ici
|
||||
|
||||
@@ -64,8 +68,66 @@ echo $output;
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Voir aussi
|
||||
<example>
|
||||
<title>Utilisation de fetch() pour envoyer un email</title>
|
||||
<para>
|
||||
Le template email_body.tpl
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
Cher {$contact.name},
|
||||
|
||||
Bienvenu et merci d'<27>tre devenu membre de notre groupe d'utilisateur,
|
||||
|
||||
Cliquez sur le lien ci-dessous pour vous identifier avec votre nom d'utilisateur '{$contact.login_id}'
|
||||
et vous pourrez utiliser nos forums.
|
||||
|
||||
http://{$smarty.server.SERVER_NAME}/index.php?page=login
|
||||
|
||||
Liste principale
|
||||
Quelques groupes d'utilisateurs
|
||||
|
||||
{include file="email_disclaimer.tpl"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Le template email_disclaimer.tpl qui utilise le modificateur
|
||||
<link linkend="language.function.textformat">{textformat}</link>.
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{textformat wrap=40}
|
||||
Unless you are named "{$contact.name}", you may read only the "odd numbered
|
||||
words" (every other word beginning with the first) of the message above. If you have
|
||||
violated that, then you hereby owe the sender 10 GBP for each even
|
||||
numbered word you have read
|
||||
{/textformat}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
et le script PHP utilisant la fonction PHP
|
||||
<ulink url="&url.php-manual;function.mail">mail()</ulink>
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// R<>cup<75>ration du contact depuis une base de donn<6E>es eg utilisation de pear ou adodb
|
||||
$query = 'select name, email, login_id from contacts where contact_id='.$contact_id;
|
||||
$contact = $db->getRow($sql);
|
||||
$smarty->assign('contact', $contact);
|
||||
|
||||
mail($contact['email'], 'Subject', $smarty->fetch('email_body.tpl'));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Voir aussi
|
||||
<link linkend="language.function.fetch">{fetch}</link>
|
||||
<link linkend="api.display">display()</link>,
|
||||
<link linkend="language.function.eval">{eval}</link> et
|
||||
|
@@ -1,27 +1,28 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.5 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.get.config.vars">
|
||||
<refnamediv>
|
||||
<refname>get_config_vars</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>get_config_vars()</refname>
|
||||
<refpurpose>Retourne la valeur de la variable de configuration pass<73>e en param<61>tre</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_config_vars</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retourne la valeur de la variable de configuration pass<73>e en param<61>tre.
|
||||
Si aucun param<61>tre n'est donn<6E>, un tableau de toutes les variables de
|
||||
configuration charg<72>es est retourn<72>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemple avec get_config_vars</title>
|
||||
<title>Exemple avec get_config_vars()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// r<>cup<75>re la variable de configuration charg<72>e 'foo'
|
||||
$foo = $smarty->get_config_vars('foo');
|
||||
|
||||
|
@@ -1,28 +1,30 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.2 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.3 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.get.registered.object">
|
||||
<refnamediv>
|
||||
<refname>get_registered_object</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>get_registered_object()</refname>
|
||||
<refpurpose>Retourne la r<>f<EFBFBD>rence d'un objet enregistr<74></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_registered_object</methodname>
|
||||
<methodparam><type>string</type><parameter>object_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retourne la r<>f<EFBFBD>rence d'un objet enregistr<74>. Utile quand vous
|
||||
voulez acc<63>der directement <20> un objet enregistr<74> avec une
|
||||
fonction utilisateur.
|
||||
Utile quand vous voulez acc<63>der directement <20> un
|
||||
<link linkend="api.register.object">objet enregistr<74></link>
|
||||
avec une fonction utilisateur. Lisez la documentation sur les
|
||||
<link linkend="advanced.features.objects">objets</link> pour plus d'informations.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemple avec get_registered_object</title>
|
||||
<title>Exemple avec get_registered_object()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function smarty_block_foo($params, &$smarty)
|
||||
function smarty_block_foo($params, &$smarty)
|
||||
{
|
||||
if (isset[$params['object']]) {
|
||||
// r<>cup<75>re la r<>f<EFBFBD>rence de l'objet enregistr<74>
|
||||
@@ -34,8 +36,15 @@ function smarty_block_foo($params, &$smarty)
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Voir aussi
|
||||
<link linkend="api.register.object">register_object()</link>,
|
||||
<link linkend="api.unregister.object">unregister_object()</link> et
|
||||
la <link linkend="advanced.features.objects">section sur les objets</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
@@ -55,4 +64,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
@@ -1,21 +1,21 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.3 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.get.template.vars">
|
||||
<refnamediv>
|
||||
<refname>get_template_vars</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>get_template_vars()</refname>
|
||||
<refpurpose>Retourne la valeur assign<67>e pass<73>e en param<61>tre</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_template_vars</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retourne la valeur assign<67>e pass<73>e en param<61>tre. Si aucun param<61>tre
|
||||
n'est donn<6E>, un tableau de toutes les variables assign<67>es est
|
||||
retourn<72>.
|
||||
Si aucun param<61>tre n'est donn<6E>, un tableau de toutes les variables
|
||||
<link linkend="api.assign">assign<EFBFBD>es</link> est retourn<72>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemple avec get_template_vars</title>
|
||||
@@ -39,11 +39,15 @@ print_r($tpl_vars);
|
||||
Voir aussi
|
||||
<link linkend="api.assign">assign()</link>,
|
||||
<link linkend="language.function.assign">{assign}</link>,
|
||||
<link linkend="api.clear.assign">clear_assign()</link> et
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>.
|
||||
<link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
||||
<link linkend="api.append">append()</link>,
|
||||
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||
<link linkend="api.clear.all.assign">clear_all_assign()</link> et
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
@@ -63,4 +67,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.4 Maintainer: gerald Status: ready -->
|
||||
<!-- EN-Revision: 1.5 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.is.cached">
|
||||
<refnamediv>
|
||||
<refname>is_cached</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>is_cached()</refname>
|
||||
<refpurpose>Retourne &true; s'il y a un fichier de cache valide pour ce template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_cached</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
@@ -15,73 +16,82 @@
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retourne &true; s'il y a un fichier de cache valide pour ce template.
|
||||
Cel<65> fonctionne seulement si <link
|
||||
linkend="variable.caching">$caching</link> est d<>fini <20> <literal>true</literal>.
|
||||
Cel<EFBFBD> fonctionne seulement si <link linkend="variable.caching">$caching</link>
|
||||
est d<>fini <20> <literal>true</literal>. Voir aussi la
|
||||
<link linkend="caching">section sur le cache</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemple avec is_cached</title>
|
||||
<title>Exemple avec is_cached()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl")) {
|
||||
if(!$smarty->is_cached('index.tpl')) {
|
||||
//aucun appel <20> la base de donn<6E>e
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl");
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Vous pouvez aussi passer en second param<61>tre un identifiant
|
||||
de $cache au cas o<> vous voudriez plusieurs fichiers de cache
|
||||
pour ce template.
|
||||
de $cache au cas o<> vous voudriez <link linkend="caching.multiple.caches">plusieurs
|
||||
fichiers</link> de cache pour ce template.
|
||||
</para>
|
||||
<para>
|
||||
Vous pouvez donner un <link linkend="variable.compile.id">identifiant de compilation</link>
|
||||
Vous pouvez donner un <link linkend="variable.compile.id">identifiant de compilation</link>
|
||||
en tant que troisi<73>me param<61>tre.
|
||||
Si vous ne sp<73>cifiez pas ce param<61>tre, le <link linkend="variable.compile.id">$compile_id</link>
|
||||
persistant sera utilis<69>.
|
||||
</para>
|
||||
<para>
|
||||
Si vous voulez utiliser un identifiant de compilation sans utilisez d'identifiant de cache,
|
||||
mettez <literal>null</literal> pour l'identifiant de cache.
|
||||
Si vous ne voulez pas passer un identifiant de cache mais plut<75>t un
|
||||
<link linkend="variable.compile.id">$compile_id</link>, vous devez passer
|
||||
<literal>null</literal> en tant qu'identifiant de cache.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemple avec is_cached et plusieurs templates</title>
|
||||
<title>Exemple avec is_cached() et plusieurs templates</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl", "FrontPage")) {
|
||||
if(!$smarty->is_cached('index.tpl', 'FrontPage')) {
|
||||
//appel de la base de donn<6E>es, assignation des variables
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl", "FrontPage");
|
||||
$smarty->display('index.tpl', 'FrontPage');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
<note>
|
||||
<title>Note technique</title>
|
||||
<para>
|
||||
Si <literal>is_cached</literal> retourne vrai, il charge en fait le cache existant et
|
||||
Si <literal>is_cached()</literal> retourne vrai, il charge en fait le cache existant et
|
||||
le stocke en interne. Tout appel suppl<70>mentaire <20>
|
||||
<link linkend="api.display">display()</link> ou
|
||||
<link linkend="api.fetch">fetch()</link> retournera ce contenu stock<63> en interne
|
||||
sans tenter de recharger le fichier en cache. Cel<65> <20>vite des probl<62>matiques d'acc<63>s concurents,
|
||||
lorsqu'un second processus efface le cache entre l'appel de is_cached et l'appel <20> display
|
||||
lorsqu'un second processus efface le cache entre l'appel de is_cached() et l'appel <20>
|
||||
<link linkend="api.display">display()</link>
|
||||
comme dans l'un de nos exemples ci-dessus. Cel<65> signifie <20>galement que les appels <20>
|
||||
<link linkend="api.clear.cache">clear_cache()</link>
|
||||
et les changements de param<61>tres du cache peuvent n'avoir aucun effet alors que
|
||||
is_cached a retourn<72> vrai.
|
||||
is_cached() a retourn<72> vrai.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Voir aussi
|
||||
<link linkend="api.clear.cache">clear_cache()</link>,
|
||||
<link linkend="api.clear.all.cache">clear_all_cache()</link> et
|
||||
la <link linkend="caching">section sur le cache</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
Reference in New Issue
Block a user