mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-09 08:41:39 +01:00
Typos correction and all translated now.
This commit is contained in:
114
docs/id/programmers/api-functions/api-display.xml
Normal file
114
docs/id/programmers/api-functions/api-display.xml
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.display">
|
||||
<refnamediv>
|
||||
<refname>display()</refname>
|
||||
<refpurpose>menampilkan template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Deskripsi</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>
|
||||
Ini menampilkan template tidak seperti
|
||||
<link linkend="api.fetch"><varname>fetch()</varname></link>.
|
||||
Sertakan tipe dan path <link
|
||||
linkend="template.resources">sumber daya template</link> yang benar.
|
||||
Sebagai parameter opsional kedua, anda bisa mengirimkan
|
||||
<parameter>$cache id</parameter>, lihat
|
||||
<link linkend="caching">seksi caching</link> untuk informasi lebih jauh.
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
<example>
|
||||
<title>display()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
include(SMARTY_DIR.'Smarty.class.php');
|
||||
$smarty = new Smarty();
|
||||
$smarty->caching = true;
|
||||
|
||||
// hanya melakukan panggilan db jika cache tidak ada
|
||||
if(!$smarty->is_cached('index.tpl')) {
|
||||
|
||||
// buat dummy untuk beberapa data
|
||||
$address = '245 N 50th';
|
||||
$db_data = array(
|
||||
'City' => 'Lincoln',
|
||||
'State' => 'Nebraska',
|
||||
'Zip' => '68502'
|
||||
);
|
||||
|
||||
$smarty->assign('Name', 'Fred');
|
||||
$smarty->assign('Address', $address);
|
||||
$smarty->assign('data', $db_data);
|
||||
|
||||
}
|
||||
|
||||
// tampilkan output
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Contoh sumber data lain dari display()</title>
|
||||
<para>
|
||||
Gunakan sintaks <link
|
||||
linkend="template.resources">sumber daya template</link> untuk
|
||||
menampilkan file di luar
|
||||
<link linkend="variable.template.dir">
|
||||
<parameter>$template_dir</parameter></link> direktori.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// path file absolut
|
||||
$smarty->display('/usr/local/include/templates/header.tpl');
|
||||
|
||||
// path file absolut (hal yang sama)
|
||||
$smarty->display('file:/usr/local/include/templates/header.tpl');
|
||||
|
||||
// path file absolut windows (HARUS memakai prefiks "file:")
|
||||
$smarty->display('file:C:/www/pub/templates/header.tpl');
|
||||
|
||||
// sertakan dari sumber daya template bernama "db"
|
||||
$smarty->display('db:header.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Lihat juga <link linkend="api.fetch"><varname>fetch()</varname></link> dan
|
||||
<link linkend="api.template.exists"><varname>template_exists()</varname></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
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user