What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
Smarty comes with several custom functions that you can use in the templates.
{assign} dipakai untuk menempatkan variabel template selama eksekusi sebuah template.
Nama Atribut | Tipe | Diperlukan | Default | Deskripsi |
---|---|---|---|---|
var | string | Ya | n/a | Nama variabel yang ditempati |
value | string | Ya | n/a | Nilai yang ditempatkan |
Teladan 8-3. Mengakses variabel {assign} dari naskah PHP Untuk mengakses variabel {assign} dari naskah php menggunakan get_template_vars(). Ini adalah template yang membuat variabel $foo.
Variabel template hanya tersedia setelah/selama eksekusi template seperti dalam naskah berikut.
|
Fungsi berikut dapat juga secara opsional menempatkan variabel template.
{capture}, {include}, {include_php}, {insert}, {counter}, {cycle}, {eval}, {fetch}, {math}, {textformat}
Lihat juga assign() dan get_template_vars().