Bab 3. Basic Syntax
All Smarty template tags are enclosed within delimiters. By
default these are { and
}, but they can be changed.
For the examples in this manual, we will assume that you are using the default
delimiters. In Smarty, all content outside of delimiters is displayed as
static content, or unchanged. When Smarty encounters template tags, it
attempts to interpret them, and displays the appropriate output in their
place.
Komentar
Komentar template dikelilingi oleh bintang, dan ditutup oleh tag
pembatas
seperti:
Komentar Smarty TIDAK ditampilkan dalam output template final, tidak seperti
<!-- HTML comments -->.
Ini berguna untuk membuat catatan internal dalam template yang tak seorangpun
akan melihatnya ;-)
Teladan 3-1. Komentar di dalam template {* Saya adalah komentar Smarty, Saya tidak ada dalam output terkompilasi *}
<html>
<head>
<title>{$title}</title>
</head>
<body>
{* komentar smarti satu baris lainnya *}
<!-- HTML comment that is sent to the browser -->
{* ini komentar smarty
multi baris
tidak dikirimkan ke browser
*}
{*********************************************************
Blok komentar multi baris dengan blok penghargaan
@ pembuat: bg@example.com
@ pemeliharan support@example.com
@ para: var yang menetapkan gaya blok
@ css: gaya output
**********************************************************}
{* File header dengan logo utama dan lainnya *}
{include file='header.tpl'}
{* Catatan Dev: var $includeFile ditempatkan dalam naskah foo.php *}
<!-- Displays main content block -->
{include file=$includeFile}
{* blok <select> ini mubazir *}
{*
<select name="company">
{html_options options=$vals selected=$selected_id}
</select>
*}
<!-- Show header from affiliate is disabled -->
{* $affiliate|upper *}
{* you cannot nest comments *}
{*
<select name="company">
{* <option value="0">-- none -- </option> *}
{html_options options=$vals selected=$selected_id}
</select>
*}
{* tag cvs untuk template, di bawah 36 HARUS kurs amerika
. akan tetapi ia diubah dalam cvs.. *}
{* $Id: Exp $ *}
{* $Id: *}
</body>
</html> |
|