Memulai Membuat Website Smarty dengan Hello World!!
Kinilah saatnya kita mulai start untuk membuat website dengan smarty, satu langkah kecil menampilakn teks Hello World dengan smarty.
Persiapan
- Pastikan di Komputer anda telah terinstall PHP & Apache + Mysql biasanya pakai XAMPP atau APP Server
- Download Smarty disini http://www.smarty.net/download.php
kebetulan kali ini saya menggunakan App Server untuk menjalankan script php smarty nya.
Tahapan
- Extract Smarty pada folder www kebetulan saya membuat folder sendiri yaitu smarty jadi strukturnya dibawah folder www ada smarty dst (www/smarty/)

- Buat satu folder helloWorld di bawah folder smarty, kenapa buat folder? karena kedepan supaya mudah untuk membuat applikasi lainnya.
- Buat 2 folder dibawah folder helloWorld yaitu folder templates bertujuan untuk menyimpan file template dan folder templates_c bertujuan untuk menyimpan cache template smarty
- dibawah folder helloWorld buat 1 file index.php di isi dengan
<?php
/**
* @author Hadi Suwantoro
*/require ‘../Smarty-2.6.26/libs/Smarty.class.php’;
$smarty = new Smarty;
$smarty->assign(‘helloworld’,'Hello World!’);
$smarty->display(‘index.tpl’);
?> - Kemudian di dalam folder templates buat satu file dengan nama index.tpl dan isi dengan
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”><head>
<meta http-equiv=”content-type” content=”text/html; charset=iso-8859-1″ />
<meta name=”author” content=”Superman” /><title>{$helloworld}</title>
</head><body>
{$helloworld}
</body>
</html> - Selanjutnya akses file index.php melalui browser alamatnya http://localhost/smarty/helloWorld/index.php
- Selesai… maka anda akan mendapati tampilan utama Hello world
Selamat mencoba.
Incoming search terms for the article:
- smarty
- membuat template dengan Smarty
- membuat hello world html
- fungsi smarty class
- apa smarty
- MEMULAI WEB
- menggunakan template smarty
- menjalankan smarty
- php smarty menggunakan
- script membuat folder public html
Related posts:
- Smarty php template Engine Bagi yang sudah kenal Smarty ya monggo[1] dilewatin saja, tapiiiii...
- Smarty Modifier dan Fungsi Itu Apa sihhh…? Sebelumnya anda harus mencoba Smarty dulu dengan mendownload dan menjalankannya...
- membuat symlink shortcut ala linux Symlink sama dengan shortcut jika kita berada pada sistem...
Related posts brought to you by Yet Another Related Posts Plugin.


May 29, 2010
|
Posted by admin

Categories:
Tags:

Adah yg lebih simple Ringan hanya 1 class template aja Lumayan lg… Namanya XTemplate….. Kapan2 tak bahas kang…
suwun frendsss