cvs: smarty /docs/fr/designers/language-basic-syntax language-escaping.xml language-math.xml /docs/fr/programmers/caching caching-cacheable.xml

"Mehdi Achour" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsdidou1081878556@cvsserver>
didou		Tue Apr 13 13:49:16 2004 EDT

  Added files:                 
    /smarty/docs/fr/programmers/caching	caching-cacheable.xml 

  Modified files:              
    /smarty/docs/fr/designers/language-basic-syntax	
                                                   	language-escaping.xml 
                                                   	language-math.xml 
  Log:
  add a new translated file and sync the two previous ones
  
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-basic-syntax/language-escaping.xml?r1=1.2&r2=1.3&ty=u
Index: smarty/docs/fr/designers/language-basic-syntax/language-escaping.xml
diff -u smarty/docs/fr/designers/language-basic-syntax/language-escaping.xml:1.2 smarty/docs/fr/designers/language-basic-syntax/language-escaping.xml:1.3
--- smarty/docs/fr/designers/language-basic-syntax/language-escaping.xml:1.2	Tue Apr 13 12:18:12 2004
+++ smarty/docs/fr/designers/language-basic-syntax/language-escaping.xml	Tue Apr 13 13:49:16 2004
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
+<!-- EN-Revision: 1.1 Maintainer: didou Status: ready -->
    <sect1 id="language.escaping">
     <title>Désactiver l'analyse de Smarty</title>
     <para>
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-basic-syntax/language-math.xml?r1=1.2&r2=1.3&ty=u
Index: smarty/docs/fr/designers/language-basic-syntax/language-math.xml
diff -u smarty/docs/fr/designers/language-basic-syntax/language-math.xml:1.2 smarty/docs/fr/designers/language-basic-syntax/language-math.xml:1.3
--- smarty/docs/fr/designers/language-basic-syntax/language-math.xml:1.2	Tue Apr 13 12:18:12 2004
+++ smarty/docs/fr/designers/language-basic-syntax/language-math.xml	Tue Apr 13 13:49:16 2004
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
+<!-- EN-Revision: 1.1 Maintainer: didou Status: ready -->
    <sect1 id="language.math">
     <title>Mathématiques</title>
     <para>

http://cvs.php.net/co.php/smarty/docs/fr/programmers/caching/caching-cacheable.xml?r=1.1&p=1
Index: smarty/docs/fr/programmers/caching/caching-cacheable.xml
+++ smarty/docs/fr/programmers/caching/caching-cacheable.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- EN-Revision: 1.3 Maintainer: didou Status: ready -->
 <sect1 id="caching.cacheable">
  <title>Contrôler la mise en cache des sorties des Plugins</title>
  <para>
   Depuis Smarty-2.6.0, la mise en cache des plugins peut être déclarée lors
   de leur inscription. Les troisièmes paramètres de register_block,
   register_compiler_function et register_function sont appelés
   <parameter>$cacheable</parameter> et valent true par défaut, ce qui est
   aussi le comportement par défaut des versions de Smarty précédent la 2.6.0
  </para>

  <para>
   Lors de l'inscription d'un plugin avec $cacheable=false, le plugin est
   appelé à chaque fois que la page est affichée, même si la page vient du
   cache. La fonction plugin se comporte presque comme la fonction
   <link linkend="plugins.inserts">insert</link>.
  </para>

  <para>
   Contrairement à <link linkend="language.function.insert">{insert}</link>
   les attributs pour le plugin ne sont pas mis en cache par défaut. Cela peut
   être le cas en utilisant le quatrième paramètre
   <parameter>$cache_attrs</parameter>. <parameter>$cache_attrs</parameter>
   est un tableau de noms d'attributs qui doivent être mis en cache, pour que 
   la fonction plugin reçoive les valeurs telles qu'elles étaient définies lorsque
   la page a été mise en cache, à chaque récupération à partir du cache.
  </para>

  <example>
   <title>Eviter la mise en cache du résultat d'un plugin</title>
   <programlisting role="php">
<![CDATA[
index.php:

<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->caching = true;

function remaining_seconds($params, &$smarty) {
    $remain = $params['endtime'] - time();
    if ($remain >=0)
        return $remain . " second(s)";
    else
        return "done";
}

$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));

if (!$smarty->is_cached('index.tpl')) {
    // récupération de $obj à partir de la page et assignation...
    $smarty->assign_by_ref('obj', $obj);
}

$smarty->display('index.tpl');
?>


index.tpl:

Time Remaining: {remain endtime=$obj->endtime}
]]>
   </programlisting>
   <para>
    Le nombre de secondes avant que la date de fin de $obj ne soit atteinte change
    à chaque affichage de la page, même si la page est mise en cache. Comme l'attribut
    endtime est mis en cache, il n'y a que l'objet qui ait besoin d'être extrait de la 
    base de données lors de la mise en cache de la page, mais pas lors des affichages
    ultérieurs de la page.
   </para>
  </example>

  <example>
   <title>Eviter la mise en cache d'une portion du template</title>
   <programlisting role="php">
<![CDATA[
index.php:

<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->caching = true;

function smarty_block_dynamic($param, $content, &$smarty) {
    return $content;
}
$smarty->register_block('dynamic', 'smarty_block_dynamic', false);

$smarty->display('index.tpl');
?>


index.tpl:

Page created: {"0"|date_format:"%D %H:%M:%S"}

{dynamic}

Now is: {"0"|date_format:"%D %H:%M:%S"}

.. do other stuff ...

{/dynamic}
]]>
   </programlisting>
  </example>
  
  <para>
   Lors du rechargement de la page, vous remarquerez que les deux dates sont différentes.
   L'une est "dynamique" et l'autre est "statique". Vous pouvez faire ce que vous voulez
   entre {dynamic}...{/dynamic} et être sûrs que cela ne sera pas mis en cache comme le 
   reste de la page.
  </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
-->

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.