2004-04-13 11:47:32 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
<!-- $Revision$ -->
|
2005-05-09 16:45:23 +00:00
|
|
|
|
<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
|
2004-12-26 17:02:12 +00:00
|
|
|
|
<refentry id="api.display">
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>display</refname>
|
|
|
|
|
<refpurpose></refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
<refsect1>
|
|
|
|
|
<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>
|
|
|
|
|
</methodsynopsis>
|
2004-05-23 15:50:53 +00:00
|
|
|
|
<para>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
Utilis<69>e pour afficher un template. Il faut fournir un type et un
|
|
|
|
|
chemin de <link
|
|
|
|
|
linkend="template.resources">ressource template</link>
|
|
|
|
|
valides. Vous pouvez passer en second param<61>tre un identifiant
|
|
|
|
|
de fichier de cache. Reportez-vous <20> la section
|
|
|
|
|
<link linkend="caching">cache</link> pour plus de renseignements.
|
2004-05-23 15:50:53 +00:00
|
|
|
|
</para>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
¶meter.compileid;
|
2004-05-23 15:50:53 +00:00
|
|
|
|
<example>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
<title>Exemple avec display</title>
|
|
|
|
|
<programlisting role="php">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
<?php
|
2004-04-13 11:47:32 +00:00
|
|
|
|
include("Smarty.class.php");
|
|
|
|
|
$smarty = new Smarty;
|
|
|
|
|
$smarty->caching = true;
|
|
|
|
|
|
2004-12-26 17:02:12 +00:00
|
|
|
|
// ne fait un appel <20> la base de donn<6E>es que si le fichier
|
2004-04-13 11:47:32 +00:00
|
|
|
|
// de cache n'existe pas
|
2004-12-26 17:02:12 +00:00
|
|
|
|
if(!$smarty->is_cached("index.tpl")) {
|
2004-04-13 11:47:32 +00:00
|
|
|
|
|
|
|
|
|
// quelques donn<6E>es
|
|
|
|
|
$address = "245 N 50th";
|
|
|
|
|
$db_data = array(
|
2004-12-26 17:02:12 +00:00
|
|
|
|
"Ville" => "Lincoln",
|
|
|
|
|
"Pays" => "Nebraska",
|
|
|
|
|
"Code postal" = > "68502"
|
|
|
|
|
);
|
2004-04-13 11:47:32 +00:00
|
|
|
|
|
2004-12-26 17:02:12 +00:00
|
|
|
|
$smarty->assign("Nom","Fred");
|
|
|
|
|
$smarty->assign("Adresse",$address);
|
2004-04-13 11:47:32 +00:00
|
|
|
|
$smarty->assign($db_data);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-09 16:45:23 +00:00
|
|
|
|
// affichage
|
2004-12-26 17:02:12 +00:00
|
|
|
|
$smarty->display("index.tpl");
|
|
|
|
|
?>
|
|
|
|
|
]]>
|
|
|
|
|
</programlisting>
|
2004-05-23 15:50:53 +00:00
|
|
|
|
</example>
|
|
|
|
|
<para>
|
|
|
|
|
Utilisez la syntaxe des <link
|
|
|
|
|
linkend="template.resources">ressources templates</link>
|
|
|
|
|
pour afficher des fichiers en-dehors du r<>pertoire
|
2004-12-26 17:02:12 +00:00
|
|
|
|
$template_dir.
|
2004-05-23 15:50:53 +00:00
|
|
|
|
</para>
|
|
|
|
|
<example>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
<title>Exemples de fonction d'affichage de ressources templates</title>
|
|
|
|
|
<programlisting role="php">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
<?php
|
2004-04-13 11:47:32 +00:00
|
|
|
|
// chemin absolu
|
|
|
|
|
$smarty->display("/usr/local/include/templates/header.tpl");
|
|
|
|
|
|
2004-12-26 17:02:12 +00:00
|
|
|
|
// chemin absolu (m<>m chose)
|
2004-04-13 11:47:32 +00:00
|
|
|
|
$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");
|
|
|
|
|
|
2004-12-26 17:02:12 +00:00
|
|
|
|
// inclue <20> partir de la ressource template nomm<6D>e "db"
|
|
|
|
|
$smarty->display("db:header.tpl");
|
|
|
|
|
?>
|
|
|
|
|
]]>
|
|
|
|
|
</programlisting>
|
2004-05-23 15:50:53 +00:00
|
|
|
|
</example>
|
2005-05-09 16:45:23 +00:00
|
|
|
|
<para>
|
|
|
|
|
Voir aussi
|
|
|
|
|
<link linkend="api.fetch">fetch()</link> et
|
|
|
|
|
<link linkend="api.template.exists">template_exists</link>.
|
|
|
|
|
</para>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
</refentry>
|
2004-05-23 15:50:53 +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
|
|
|
|
|
-->
|