Home  |  Linux  | Mysql  | PHP  | XML
From:Messju Mohr Date:Mon Sep 17 05:26:17 2007
Subject:cvs: smarty /docs/id bookinfo.xml getting-started.xml language-defs.ent language-snippets.ent livedocs.ent preface.xml
messju		Mon Sep 17 11:26:17 2007 UTC

  Added files:                 
    /smarty/docs/id	bookinfo.xml getting-started.xml language-defs.ent 
                   	language-snippets.ent livedocs.ent preface.xml 
  Log:
  added indonesian docs - thanks Zaenal Mutaqin
  

http://cvs.php.net/viewvc.cgi/smarty/docs/id/bookinfo.xml?view=markup&rev=1.1
Index: smarty/docs/id/bookinfo.xml
+++ smarty/docs/id/bookinfo.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
 <bookinfo id="bookinfo">
  <title>Smarty - mesin template yang mengompilasi PHP</title>
  <authorgroup id="authors">
   <author>
    <firstname>Monte</firstname>
    <surname>Ohrt &lt;monte at ohrt dot com&gt;</surname>
   </author>
   <author>
    <firstname>Andrei</firstname>
    <surname>Zmievski &lt;andrei@php.net&gt;</surname>
   </author>
  </authorgroup>
  <pubdate>&build-date;</pubdate>
  <copyright>
   <year>2001-2005</year>
   <holder>New Digital Group, Inc.</holder>
  </copyright>
 </bookinfo>

<!-- 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
-->

http://cvs.php.net/viewvc.cgi/smarty/docs/id/getting-started.xml?view=markup&rev=1.1
Index: smarty/docs/id/getting-started.xml
+++ smarty/docs/id/getting-started.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<part id="getting.started">
 <title>Memulai</title>

 <chapter id="what.is.smarty">
  <title>Apa itu Smarty?</title>
  <para>
   Smarty adalah mesin template untuk PHP. Lebih khusus, ia memfasilitasi 
   cara yang bisa diatur untuk memisahkan logika aplikasi dan konten dari 
   penampilannya. Ini jauh lebih baik dijelaskan dalam situasi di mana 
   pemrogram aplikasi dan desainer template memainkan aturan yang berbeda, 
   atau secara umum bukan orang yang sama.
  </para>

  <para>
   Sebagai contoh, katakanlah anda sedang membuat halaman web yang 
   menampilkan artikel koran.
   </para>
   <itemizedlist>
   <listitem><para>
   Artikel <literal>$headline</literal>, <literal>$tagline</literal>,
   <literal>$author</literal> dan <literal>$body</literal> adalah elemen
   konten, tidak berisi informasi mengenai bagaimana akan ditampilkan.
   Ia akan <link linkend="api.assign">dioper</link> ke dalam Smarty
   oleh aplikasi.
   </para></listitem>

   <listitem><para>Kemudian desainer template mengedit template dan 
   menggunakan kombinasi tag HTML dan 
   <link linkend="language.basic.syntax">tag template</link> untuk 
   membentuk presentasi terhadap
   <link linkend="language.syntax.variables">variabel</link> ini dengan
   elemen seperti tabel, div, warna latar belakang, ukuran font, style 
   sheets, svg dll.
   </para></listitem>

   <listitem><para>Suatu hari pemrogram perlu mengubah cara konten 
   artikel diambil (perubahan dalam logika aplikasi). Perubahan 
   ini tidak mempengaruhi desainer template, konten masih akan 
   muncul dalam template persis sama.
   </para></listitem>

   <listitem><para>
   Demikian juga jika desainer template ingin mendesain ulang template 
   seutuhnya, ini tidak memerlukan perubahan logika aplikasi.
   </para></listitem>

   <listitem><para>Oleh karena itu, pemrogram dapat membuat perubahan 
   terhadap logika aplikasi tanpa perlu merestrukturisasi template, dan 
   desainer template bisa membuat perubahan terhadap template tanpa 
   membongkar logika aplikasi.
  </para></listitem>
  </itemizedlist>

  <para>
   Satu tujuan desain Smarty adalah pemisahan logika  bisnis dan logika
   presentasi.
   </para>

   <itemizedlist>
   <listitem><para>
   Ini berarti template tentu saja dapat berisi logika di bawah
   kondisi yang hanya untuk presentasi saja. Hal seperti
   <link linkend="language.function.include">menyertakan</link>
   template lain,
   <link linkend="language.function.cycle">memilih</link> warna baris tabel,
   <link linkend="language.modifier.upper">membesarkan huruf</link> variabel,
   <link linkend="language.function.foreach">mengulang</link> terus
   sebuah data array dan <link linkend="api.display">menampilkannya</link>
   adalah contoh dari logika presentasi.
   </para></listitem>
   <listitem><para>
   Ini tidak
   berarti bahwa Smarty memaksa pemisahan logika bisnis dan presentasi. Smarty 
   tidak mengetahui yang mana adalah yang mana, maka menempatkan logika bisnis
   dalam template adalah anda sendiri yang melakukannya.
    </para></listitem>
   <listitem><para>Juga, jika anda 
   menginginkan <emphasis>tidak ada</emphasis> logika dalam template, anda 
   tentunya dapat melakukannya dengan menetapkan konten cukup ke teks dan 
   variabel saja.
  </para></listitem>
  </itemizedlist>

  <para>
   Salah satu aspek unik mengenai Smarty adalah kompilasi template. Ini
   berartu Smarty membaca file template dan membuat naskah PHP darinya. 
   Sekali dibuat, selanjutnya ia dieksekusi darinya. Oleh karenanya tidak
   ada beban menguraikan file template untuk setiap permintaan, dan setiap 
   template dapat memanfaatkan solusi cache kompilator PHP seperti 
   <ulink url="&url.e-accel;">eAccelerator</ulink>,
   <ulink url="&url.ion-accel;">ionCube</ulink>
   <ulink url="&url.mmcache-accel;">mmCache</ulink>
   atau <ulink url="&url.zend;">Zend Accelerator</ulink>
   adalah beberapa diantaranya.
  </para>
  <para>
   <emphasis role="bold">Beberapa fitur Smarty:</emphasis>
  </para>
  <itemizedlist>
   <listitem>
    <para>
     Sangat cepat.
    </para>
   </listitem>
   <listitem>
    <para>
     Efisien karena pengurai PHP yang mengerjakan pekerjaan beratnya.
    </para>
   </listitem>
   <listitem>
    <para>
     Tidak ada kelebihan penguraian template, hanya sekali mengompilasi.
    </para>
   </listitem>
   <listitem>
    <para>
     Pintar mengenai <link linkend="variable.compile.check">rekompilasi</link>
     hanya file template yang telah diubah.
    </para>
   </listitem>
   <listitem>
    <para>
     Anda dapat membuat dengan mudah <link
     linkend="language.custom.functions">fungsi</link> kustom
     dan <link linkend="language.modifiers">pengubah variabel</link>, agar 
     bahasa template bisa diperluas secara ekstrim.
    </para>
   </listitem>
   <listitem>
    <para>
     Template bisa mengkonfigurasi sintaks tag
     <link linkend="variable.left.delimiter">{pemisah}</link>, agar
     anda dapat menggunakan
     <literal>{$foo}</literal>, <literal>{{$foo}}</literal>,
     <literal>&lt;!--{$foo}--&gt;</literal>, dll.
    </para>
   </listitem>
   <listitem>
    <para>
     Konstruksi <link linkend="language.function.if">
     <literal>{if}..{elseif}..{else}..{/if}</literal></link>
     dioper ke pengurai PHP, maka sintaks ekspresi <literal>{if...}</literal> 
     bisa berupa evaluasi sesederhana atau serumit yang anda 
     inginkan.
    </para>
   </listitem>
   <listitem>
    <para>
     Membolehkan pengulangan tidak terbatas dari 
     <link linkend="language.function.section">
     <varname>sections</varname></link>, <varname>if's</varname> dll.
    </para>
   </listitem>
   <listitem>
    <para>
     Dimungkinkan untuk
     <link linkend="language.function.php">menyertakan kode PHP</link>
     langsung dalam file template anda, meskipun ini mungkin tidak 
     diperlukan (ataupun direkomendasikan) karena mesin
     <link linkend="plugins">dapat dikustomisasi</link>.
    </para>
   </listitem>
   <listitem>
    <para>
     Dukungan built-in <link linkend="caching">caching</link> 
    </para>
   </listitem>
   <listitem>
    <para>
     Bebas sumber <link linkend="template.resources">template</link>
    </para>
   </listitem>
   <listitem>
    <para>
     Fungsi kustom
     <link
     linkend="section.template.cache.handler.func">penanganan cache</link>
    </para>
   </listitem>
   <listitem>
    <para>
     Arsitektur <link linkend="plugins">Plugin</link>
    </para>
   </listitem>
  </itemizedlist>
 </chapter>





 <chapter id="installation">
  <title>Instalasi</title>

  <sect1 id="installation.requirements">
   <title>Persyaratan</title>
   <para>
    Smarty membutuhkan server web yang menjalankan PHP 4.0.6 atau lebih 
    tinggi.
   </para>
  </sect1>

  <sect1 id="installing.smarty.basic">
   <title>Instalasi Dasar</title>

   <para>
    Instalasi file librari Smarty yang ada dalam sub direktori
    <filename class="directory">/libs/</filename>  dari
    distributsi. Ini adalah file <filename>.php</filename> yang 
    TIDAK BOLEH diedit. Ia berbagi diantara seluruh aplikasi dan hanya
    diubah ketika anda meingkatkannya ke versi Smarty baru.
   </para>
   <para>Dalam contoh di bawah ini Smarty tarball telah diuraikan ke:
   <itemizedlist>
   <listitem><para>
   <filename class="directory">/usr/local/lib/Smarty-v.e.r/</filename> untuk
   mesin *nix</para></listitem>
   <listitem><para> dan
   <filename class="directory">c:\webroot\libs\Smarty-v.e.r\</filename> untuk
   lingkungan windows.</para></listitem>
   </itemizedlist>
   </para>

   <example>
    <title>File librari Smarty yang Diperlukan</title>
    <screen>
<![CDATA[
Smarty-v.e.r/
   libs/
      Smarty.class.php
      Smarty_Compiler.class.php
      Config_File.class.php
      debug.tpl
      internals/*.php  (all of them)
      plugins/*.php    (all of them)
]]>
    </screen>
   </example>

   <para>
    Smarty menggunakan <ulink url="&url.php-manual;define">konstan</ulink>
    PHP bernama <link linkend="constant.smarty.dir"><constant>SMARTY_DIR</constant>
    </link> yang merupakan <emphasis role="bold">path file sistem lengkap</emphasis>
    ke direktori <filename>libs/</filename> Smarty.
    Pada dasarnya, jika aplikasi anda dapat menemukan file
    <filename>Smarty.class.php</filename>, anda tidak perlu menyetel 
    <link linkend="constant.smarty.dir"><constant>SMARTY_DIR</constant></link>
    karena Smarty akan mengetahui dirinya sendiri.
    Oleh karena itu, jika
    <filename>Smarty.class.php</filename> tidak dalam 
    <ulink url="&url.php-manual;ini.core.php#ini.include-path">include_path</ulink>
    anda, atau anda tidak menyertakan path absolut kepadanya dalam aplikasi
    anda, maka anda harus mendefinisikan <constant>SMARTY_DIR</constant> 
    secara manual.
    <constant>SMARTY_DIR</constant> <emphasis role="bold">harus menyertakan
    akhiran garis miring/</emphasis>.
   </para>


   <informalexample>
   <para>
    Ini adalah bagaimana anda membuat turunan Smarty dalam naskah PHP anda:
   </para>
    <programlisting role="php">
<![CDATA[
<?php
// NOTE: Smarty has a capital 'S'
require_once('Smarty.class.php');
$smarty = new Smarty();
?>
]]>
    </programlisting>
   </informalexample>

   <para>
    Coba menjalankan naskah di atas. Jika anda mendapatkan kesalahan yang
    mengatakan
    <filename>Smarty.class.php</filename> file could not be found, anda perlu
    melakukan salah satu dari yang berikut:
   </para>

   <example>
    <title>Setel konstan SMARTY_DIR secara manual</title>
    <programlisting role="php">
<![CDATA[
<?php
// *nix style (note capital 'S')
define('SMARTY_DIR', '/usr/local/lib/Smarty-v.e.r/libs/');

// windows style
define('SMARTY_DIR', 'c:/webroot/libs/Smarty-v.e.r/libs/');

// hack version example that works on both *nix and windows
// Smarty is assumend to be in 'includes/' dir under current script
define('SMARTY_DIR',str_replace("\\","/",getcwd()).'/includes/Smarty-v.e.r/libs/');

require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
?>
]]>
    </programlisting>
   </example>

   <example>
    <title>Sertakan path absolut ke file librari</title>
    <programlisting role="php">
<![CDATA[
<?php
// *nix style (note capital 'S')
require_once('/usr/local/lib/Smarty-v.e.r/libs/Smarty.class.php');

// windows style
require_once('c:/webroot/libs/Smarty-v.e.r/libs/Smarty.class.php');

$smarty = new Smarty();
?>
]]>
    </programlisting>
   </example>

   <example>
    <title>Tambah path librari ke file <filename>php.ini</filename></title>
     <programlisting role="php">
<![CDATA[
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; *nix: "/path1:/path2"
include_path = ".:/usr/share/php:/usr/local/lib/Smarty-v.e.r/libs/"

; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;c:\webroot\libs\Smarty-v.e.r\libs\"
]]>
</programlisting>
</example>

<example>
    <title>Menambahkan path include dalam naskah PHP dengan
    <literal><ulink url="&url.php-manual;ini-set">ini_set()</ulink></literal></title>
    <programlisting role="php">
<![CDATA[
<?php
// *nix
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'/usr/local/lib/Smarty-v.e.r/libs/');

// windows
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'c:/webroot/lib/Smarty-v.e.r/libs/');
?>
]]>
    </programlisting>
   </example>

   <para>
    Sekarang file librari itu di tempatnya, waktunya menyiapkan 
    direktori Smarty untuk aplikasi anda:</para>

    <itemizedlist>
    <listitem><para>
    Smarty memerlukan empat direktori yang secara standar bernama 
    <filename class="directory">templates/</filename>,
    <filename class="directory">templates_c/</filename>, <filename
    class="directory">configs/</filename> dan <filename
    class="directory">cache/</filename>
    </para></listitem>

    <listitem><para>Setiap dari yang di atas tersebut bisa didefinisikan 
    dengan properti kelas Smarty masing-masing
    <link linkend="variable.template.dir">
    <varname>$template_dir</varname></link>,
    <link linkend="variable.compile.dir">
    <varname>$compile_dir</varname></link>,
    <link linkend="variable.config.dir">
    <varname>$config_dir</varname></link>, dan
    <link linkend="variable.cache.dir">
    <varname>$cache_dir</varname></link>
    </para></listitem>

    <listitem><para>
    It is highly recommended
    that you setup a separate set of these directories for each application
    that will use Smarty
   </para></listitem>
    </itemizedlist>

    <para>
    For our installation example, we will be setting up the Smarty environment
    for a guest book application. We picked an application only for the purpose
    of a directory naming convention. You can use the same environment for any
    application, just replace <literal>guestbook/</literal> with
    the name of your application.
    </para>


   <example>
    <title>What the file structure looks like</title>
    <screen>
<![CDATA[
/usr/local/lib/Smarty-v.e.r/libs/
        Smarty.class.php
        Smarty_Compiler.class.php
        Config_File.class.php
        debug.tpl
        internals/*.php
        plugins/*.php

/web/www.example.com/
        guestbook/
                templates/
                    index.tpl
                templates_c/
                configs/
                cache/
                htdocs/
                    index.php
]]>
    </screen>
   </example>

   <para>
    Be sure that you know the location of your web server's document root as a
    file path. In the following examples, the document root is <filename
    class="directory">/web/www.example.com/guestbook/htdocs/</filename>.
    The Smarty
    directories are only accessed by the Smarty library and never accessed
    directly by the web browser. Therefore to avoid any security concerns, it
    is recommended (but not mandatory) to place these directories
    <emphasis>outside</emphasis> of the web server's document root.
   </para>

   <para>
    You will need as least one file under your document root, and that is the
    script accessed by the web browser. We will name our script
    <filename>index.php</filename>, and place it in a subdirectory under the
    document root <filename class="directory">/htdocs/</filename>.
   </para>


   <para>
    Smarty will need <emphasis role="bold">write access</emphasis>
    (windows users please ignore) to the
    <link linkend="variable.compile.dir">
    <parameter>$compile_dir</parameter></link> and
    <link linkend="variable.cache.dir">
    <parameter>$cache_dir</parameter></link> directories
    (<filename class="directory">templates_c/</filename> and
    <filename class="directory">cache/</filename>), so be sure the web server
    user account can write  to them.

    <note><para>This is usually user <quote>nobody</quote> and
    group <quote>nobody</quote>. For OS X users,
    the default is user <quote>www</quote> and group <quote>www</quote>.
    If you are using Apache, you can  look in your
    <filename>httpd.conf</filename> file to see
    what user and group are being used.</para></note>
    </para>

   <example>
    <title>Permissions and making directories writable</title>
    <programlisting role="shell">
<![CDATA[
chown nobody:nobody /web/www.example.com/guestbook/templates_c/
chmod 770 /web/www.example.com/guestbook/templates_c/

chown nobody:nobody /web/www.example.com/guestbook/cache/
chmod 770 /web/www.example.com/guestbook/cache/
]]>
    </programlisting>
   </example>

   <note>
    <title>Note</title>
    <para>
     <literal>chmod 770</literal> will be fairly tight security, it only allows
     user <quote>nobody</quote> and group <quote>nobody</quote> read/write access
     to the directories. If you would like to  open up read access to anyone
     (mostly for your own convenience of viewing
     these files), you can use <literal>775</literal> instead.
    </para>
   </note>

   <para>
    We need to create the <filename>index.tpl</filename> file that Smarty will
    display. This needs to be located in the <link linkend="variable.template.dir">
    <parameter>$template_dir</parameter></link>.
   </para>

   <example>
    <title>/web/www.example.com/guestbook/templates/index.tpl</title>
    <screen>
<![CDATA[
{* Smarty *}

Hello {$name}, welcome to Smarty!
]]>
    </screen>
   </example>

   <note>
    <title>Technical Note</title>
    <para>
     <literal>{* Smarty *}</literal> is a template
     <link linkend="language.syntax.comments">comment</link>.
     It is not required, but it is good
     practice to start all your template files with this comment. It makes
     the file easy to recognize regardless of the file extension. For
     example, text editors could recognize the file and turn on special
     syntax highlighting.
    </para>
   </note>

   <para>
    Now lets edit <filename>index.php</filename>. We'll create an instance of Smarty,
    <link linkend="api.assign"><varname>assign()</varname></link> a
    template variable and <link linkend="api.display"><varname>display()</varname></link>
    the <filename>index.tpl</filename> file.
   </para>

   <example>
    <title>Editing /web/www.example.com/docs/guestbook/index.php</title>
    <programlisting role="php">
<![CDATA[
<?php

require_once(SMARTY_DIR . 'Smarty.class.php');

$smarty = new Smarty();

$smarty->template_dir = '/web/www.example.com/guestbook/templates/';
$smarty->compile_dir  = '/web/www.example.com/guestbook/templates_c/';
$smarty->config_dir   = '/web/www.example.com/guestbook/configs/';
$smarty->cache_dir    = '/web/www.example.com/guestbook/cache/';

$smarty->assign('name','Ned');

//** un-comment the following line to show the debug console
//$smarty->debugging = true;

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

?>
]]>
    </programlisting>
   </example>

   <note>
    <title>Note</title>
    <para>
     In our example, we are setting absolute paths to all of the Smarty
     directories. If <filename
     class="directory">/web/www.example.com/guestbook/</filename> is
     within your PHP include_path, then these settings are not necessary.
     However, it is more efficient and (from experience) less error-prone to
     set them to absolute paths. This ensures that Smarty is getting files
     from the directories you intended.
    </para>
   </note>

   <para>
    Now naviagate to the <filename>index.php</filename> file with the web browser.
    You should see <emphasis>"Hello Ned, welcome to Smarty!"</emphasis>
   </para>
   <para>
    You have completed the basic setup for Smarty!
   </para>
  </sect1>





  <sect1 id="installing.smarty.extended">
   <title>Extended Setup</title>

   <para>
    This is a continuation of the <link
    linkend="installing.smarty.basic">basic installation</link>, please read
    that first!
   </para>
   <para>
    A slightly more flexible way to setup Smarty is to
    <ulink url="&url.php-manual;ref.classobj">extend the class</ulink> and
    initialize your Smarty environment. So instead of repeatedly setting
    directory paths, assigning the same vars, etc., we can do that in one place.
    </para>
    <para>
    Lets create a new directory <filename
    class="directory">/php/includes/guestbook/</filename>
     and make a new file called <filename>setup.php</filename>. In our example
     environment, <filename class="directory">/php/includes</filename> is in our
     <literal>include_path</literal>.
     Be sure you set this up too, or use absolute file paths.
   </para>

   <example>
    <title>/php/includes/guestbook/setup.php</title>
    <programlisting role="php">
<![CDATA[
<?php

// load Smarty library
require('Smarty.class.php');

// The setup.php file is a good place to load
// required application library files, and you
// can do that right here. An example:
// require('guestbook/guestbook.lib.php');

class Smarty_GuestBook extends Smarty {

   function Smarty_GuestBook()
   {

        // Class Constructor.
        // These automatically get set with each new instance.

        $this->Smarty();

        $this->template_dir = '/web/www.example.com/guestbook/templates/';
        $this->compile_dir  = '/web/www.example.com/guestbook/templates_c/';
        $this->config_dir   = '/web/www.example.com/guestbook/configs/';
        $this->cache_dir    = '/web/www.example.com/guestbook/cache/';

        $this->caching = true;
        $this->assign('app_name', 'Guest Book');
   }

}
?>
]]>
    </programlisting>
   </example>

  <para>
   Now lets alter the <filename>index.php</filename> file to use
   <filename>setup.php</filename>:
  </para>

  <example>
   <title>/web/www.example.com/guestbook/htdocs/index.php</title>
   <programlisting role="php">
<![CDATA[
<?php

require('guestbook/setup.php');

$smarty = new Smarty_GuestBook();

$smarty->assign('name','Ned');

$smarty->display('index.tpl');
?>
]]>
   </programlisting>
  </example>

  <para>
   Now you see it is quite simple to bring up an instance of Smarty, just use
   <literal>Smarty_GuestBook()</literal> which automatically initializes everything for our
   application.
  </para>

  </sect1>

 </chapter>
</part>

<!-- 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
-->

http://cvs.php.net/viewvc.cgi/smarty/docs/id/language-defs.ent?view=markup&rev=1.1
Index: smarty/docs/id/language-defs.ent
+++ smarty/docs/id/language-defs.ent
<!-- $Revision: 1.1 $ -->

<!ENTITY SMARTYManual      "Manual Smarty">
<!ENTITY SMARTYDesigners   "Smarty Untuk Desainer Template">
<!ENTITY SMARTYProgrammers "Smarty Untuk Pemrogram">
<!ENTITY Appendixes        "Apendiks">

http://cvs.php.net/viewvc.cgi/smarty/docs/id/language-snippets.ent?view=markup&rev=1.1
Index: smarty/docs/id/language-snippets.ent
+++ smarty/docs/id/language-snippets.ent
<!-- $Revision: 1.1 $ -->

<!ENTITY note.parameter.merge '<note>
 <title>Catatan Teknis</title>
 <para>
  Parameter <parameter>merge</parameter> merupakan kunci array, maka jika
  anda menggabung dua array berindeks secara numerik, keduanya bisa saling
  menimpa atau hasil dalam kunci non-sekuensial. Ini tidak seperti fungsi 
  PHP <ulink url="&url.php-manual;array_merge"> 
  <varname>array_merge()</varname></ulink> yang menghapus kunci numerik 
  dan menomorinya kembali.
 </para>
</note>'>

<!ENTITY note.parameter.function '<note>
 <title>Catatan Teknis</title>
 <para>
  Jika <parameter>fungsi</parameter> callback yang dipilih dalam bentuk 
  <literal>array(&amp;$object, $method)</literal>, hanya satu turunan dari 
  class yang sama dan dengan <literal>$method</literal> yang sama bisa 
  diregistrasi. <parameter>Fungsi</parameter> callback teregistrasi terbaru
  akan digunakan dalam skenario seperti itu.
 </para>
</note>'>

<!ENTITY parameter.compileid '<para>
 Sebagai parameter opsional ketiga, anda dapat mengoper 
 <parameter>$compile_id</parameter>.
 Ini dalam keadaan di mana anda ingin mengompilasi versi berbeda terhadap
 template yang sama, seperti memiliki template terpisa dikompilasi untuk 
 bahasa yang berbeda. Penggunaan lainnya untuk
 <parameter>$compile_id</parameter> ialah saat anda menggunakan lebih dari
 satu
 <link linkend="variable.template.dir"><parameter>$template_dir</parameter></link>
 tapi hanya satu
 <link linkend="variable.compile.dir"><parameter>$compile_dir</parameter></link>.
 Set <parameter>$compile_id</parameter> secara terpisah untuk setiap
 <link linkend="variable.template.dir"><parameter>$template_dir</parameter></link>,
 atau sebaliknya template dengan nama sama akan saling menimpa. Anda juga
 bisa menyetel variabel <link linkend="variable.compile.id">
 <parameter>$compile_id</parameter></link> sekali daripada mengoperkan ini
 ke setiap pemanggilan fungsi ini.
</para>'>

<!ENTITY api.register.snippet '<para>
   Fungsi-php callback <parameter>function</parameter> dapat berupa:
   <itemizedlist>
       <listitem><para>
       String yang berisi <parameter>nama</parameter> fungsi
       </para></listitem>

       <listitem><para>
       Sebuah array dalam bentuk <literal>array(&amp;$object, $method)</literal> dengan
       <literal>&amp;$object</literal> menjadi referensi ke sebuah
       obyek dan <literal>$method</literal> menjadi string yang
       berisi nama-metode
       </para></listitem>

       <listitem><para>
       Sebuah array dalam bentuk
       <literal>array($class, $method)</literal> dengan
       <literal>$class</literal> menjadi nama kelas dan 
       <literal>$method</literal> menjadi metode kelas.
       </para></listitem>
   </itemizedlist>
  </para>'>
http://cvs.php.net/viewvc.cgi/smarty/docs/id/livedocs.ent?view=markup&rev=1.1
Index: smarty/docs/id/livedocs.ent
+++ smarty/docs/id/livedocs.ent
<!-- $Revision: 1.1 $ -->

<!ENTITY livedocs.author 'Pembuat:<br />'>
<!ENTITY livedocs.editors 'Disunting oleh:<br />'>
<!ENTITY livedocs.copyright 'Hak Cipta &copy; %s by %s'>
<!ENTITY livedocs.published 'Diterbitkan pada: %s'>

http://cvs.php.net/viewvc.cgi/smarty/docs/id/preface.xml?view=markup&rev=1.1
Index: smarty/docs/id/preface.xml
+++ smarty/docs/id/preface.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
 <preface id="preface">
  <title>Kata Pengantar</title>
  <para>
   Tidak diragukan lagi salah satu pertanyaan yang paling sering diajukan 
   pada milis PHP: bagaimana saya membuat naskah PHP independen terhadap 
   tata letak? Sementara PHP dihitung sebagai "bahasa penaskahan melekat HTML", 
   setelah menulis beberapa proyek yang mencampur PHP dan HTML secara bebas, 
   datanglah satu ide yang memisahkan formulir dan isis adalah Good Thing [TM]. 
   Sebagai tambahan, dalam banyak perusahaan aturan pendesain tata letak dan 
   pemrogram adalah terpisah. Konsekuensinya, pencarian solusi templating 
   terjadi kemudian.
  </para>
  <para>
   Dalam perusahaan kami contohnya, pengembangan aplikasi terjadi
   sebagai berikut: Setelah peryaratan dokumen selesai, pendesain
   interface membuat maket interface dan memberikannya ke pemrogram.
   Pemrogram mengimplementasikan logika bisnis dalam PHP dan menggunakan 
   maket interface untuk membuat rangka template. Proyek kemudian diserahkan 
   ke pendesain HTML/ata letak halaman web, orang tang membawa template 
   sampai penuh dengan kemegahan. Proyek mungkin bolak-balik diantara 
   pemrogram/HTML beberapa kali. Selanjutnya, adalah penting untuk mempunyai 
   dukungan template karena pemrogram tidak ingin melakukan hal yang 
   berkaitan dengan HTML dan tidan ingin pendesain HTML memaketkannya dengan 
   kode PHP. Pendesain memerlukan dukungan untuk file konfigurasi, blok 
   dinamis dan hal lain yang berkenaan dengan interface, tapi mereka tidak 
   harus berhadapan dengan kerumitan bahasa pemrograman PHP.
  </para>
  <para>
   Melihat di banyaknya solusi template untuk PHP hari ini, kebanyakan
   darinya menyediakan cara yang belum sempurna atas penggantian variabel 
   ke dalam template dan melakukan bentuk terbatas dari fungsionalitas blok 
   dinamis. Tapi kebutuhan kita memerlukan sedikit lebih banyak dari itu. 
   Kami tidak menginginkan pemrogram untuk berurusan dengan tata letak HTML 
   SAMA SEKALI, tapi ini hampir tidak bisa dihindari. Sebagai contoh, jika 
   pendesain menginginkan warna latar belakang untuk berubah pada blok 
   dinamis, ini harus dikerjakan dengan pemrogram terlebih dulu. Kami juga 
   membutuhkan pendesain untuk bisa menggunakan file konfigurasinya sendiri, 
   dan menarik variabel darinya ke dalam template. Daftar terus bertambah.
  </para>
  <para>
   Kami mulai menulis spesifikasi untuk mesin template di akhir 1999.  
   Setelah menyelesaikan spesifikasi, kami mulai bekerja pada mesin template 
   yang ditulis dalam C yang dengan harapan dapat diterima untuk disertakan 
   dengan PHP. Kami tidak hanya mengalami teknis yang kompleks, tapi juga 
   ada debat panas mengenai apa yang harus dilakukan dan tidak oleh mesin 
   template . Dari pengalaman ini, kami memutuskan bahwa mesin template 
   harus ditulis dalam PHP sebagai kelas, agar setiap orang menggunakannya 
   bila sesuai. Maka kami menulis mesin yang tidak hanya itu dan
   <productname>SmartTemplate</productname> memperlihatkan keberadaannya 
   (catatan: kelas ini tidak pernah dikirimkan untuk umum). Ia adalah kelas 
   yang mengerjakan hampir apapun yang kami inginkan: substitusi variabel 
   reguler, didukung termasuk template lain, integrasi dengan file 
   konfigurasi, melekatkan kode PHP, fungsionalitas pernyataan 'if' terbatas 
   dan blok dinamis lebih stabil yang dapat diperbanyak secara berulang. Ia 
   melakukan ini semua dengan ekspresi reguler dan kode diubah menjadi, 
   harus kami katakan, bisa dipahami. Ia juga tercatat lambat dalam aplikasi 
   besar dari semua penguraian dan ekspresi reguler mengerjakannya harus 
   melakukannya untuk setiap permintaan. Masalah terbesar dari sudut pandang 
   pemrogram adalah semua pekerjaan yang perlu dalam naskah PHP untuk 
   menyiapkan dan memproses template dan blok dimasis. Bagaimana kami membuat
   ini lebih mudah?
  </para>
  <para>
   Lalu datanglah bayangan atas apa yang secara utama menjadi Smarty. Kami 
   mengtahui seberapa cepat kode PHP tanpa melebihkan penguraian template. 
   Kami juga mengetahui bagaimana teliti dan memaksanya bahasa PHP terlihat
   bagi umumnya pendesain, dan ini bisa diatasi dengan sintaks template yang
   lebih sederhana. Lalu bagaimana jika kami menggabungkan dua kekuatan? 
   Selanjutnya, Smarty dilahirkan... :-)
  </para>
 </preface>

<!-- 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
-->

Navigate in group php.smarty.cvs at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants