mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-30 20:01:37 +01:00
118 lines
3.2 KiB
XML
118 lines
3.2 KiB
XML
<?xml version="1.0" encoding="windows-1251"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 1.6 Maintainer: freespace Status: ready -->
|
|
<refentry id="api.display">
|
|
<refnamediv>
|
|
<refname>display()</refname>
|
|
<refpurpose>îòîáðàæàåò øàáëîí</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Îïèñàíèå</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>
|
|
<para>
|
|
Äàííàÿ ôóíêöèÿ îòîáðàæàåò øàáëîí, â îòëè÷èå îò
|
|
<link linkend="api.fetch">fetch()</link>.
|
|
 êà÷åñòâå ïåðâîãî àðãóìåíòà ñëåäóåäóåò óêàçàòü äîñòóïíûé òèï è ïóòü ê
|
|
<link linkend="template.resources">ðåñóðñó øàáëîíà</link>.
|
|
 êà÷åñòâå âòîðîãî íåîáÿçàòåëüíîãî àðãóìåòà, âû ìîæåòå ïåðåäàòü èäåíòèôèêàòîð
|
|
êýøà.
|
|
Ñì. ðàçäåë
|
|
<link linkend="caching">Êýøèðîâàíèå</link>
|
|
äëÿ ïîëó÷åíèÿ äîïîëíèòåëüíîé èíôîðìàöèè.
|
|
</para>
|
|
¶meter.compileid;
|
|
<example>
|
|
<title>display()</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
include("Smarty.class.php");
|
|
$smarty = new Smarty;
|
|
$smarty->caching = true;
|
|
|
|
// âûïîëíÿåì çàïðîñ ê ÁÄ òîëüêî â òîì ñëó÷àå, åñëè êýø íå ñóùåñòâóåò
|
|
if(!$smarty->is_cached("index.tpl")) {
|
|
|
|
// íåìíîãî äàííûõ äëÿ ïðèìåðà
|
|
$address = "245 N 50th";
|
|
$db_data = array(
|
|
"City" => "Lincoln",
|
|
"State" => "Nebraska",
|
|
"Zip" => "68502"
|
|
);
|
|
|
|
$smarty->assign("Name","Fred");
|
|
$smarty->assign("Address",$address);
|
|
$smarty->assign($db_data);
|
|
|
|
}
|
|
|
|
// âûâîäèì ðåçóëüòàò
|
|
$smarty->display("index.tpl");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<para>
|
|
Èñïîëüçóéòå ñèíòàêñèñ <link
|
|
linkend="template.resources">ðåñóðñîâ øàáëîíà</link> äëÿ îòîáðàæåíèÿ ôàéëîâ
|
|
çà ïðåäåëàìè äèðåêòîðèè
|
|
<link linkend="variable.template.dir">$template_dir</link>.
|
|
</para>
|
|
<example>
|
|
<title>Ïðèìåð ðàáîòû ôóíêöèè display() ñ ðåñóðñàìè øàáëîíà</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// àáñîëþòíûé ôàéëîâûé ïóòü
|
|
$smarty->display('/usr/local/include/templates/header.tpl');
|
|
|
|
// àáñîëþòíûé ôàéëîâûé ïóòü (òîò æå ðåçóëüòàò)
|
|
$smarty->display('file:/usr/local/include/templates/header.tpl');
|
|
|
|
// àáñîëþòíûé ôàéëîâûé ïóòü ïîä Windows (ïðåôèêñ "file:" ÎÁßÇÀÒÅËÅÍ)
|
|
$smarty->display('file:C:/www/pub/templates/header.tpl');
|
|
|
|
// èñïîëüçîâàíèå ðåñóðñà øàáëîíà ñ èìåíåì "db"
|
|
$smarty->display('db:header.tpl');
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<para>
|
|
Ñì. òàêæå
|
|
<link linkend="api.fetch">fetch()</link>
|
|
è
|
|
<link linkend="api.template.exists">template_exists()</link>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- 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
|
|
-->
|
|
|