Smarty kullanimi

Şubat 1st, 2008

Herkeze Merhaba,
burda yazdigimiz konuda smarty yi nasil kurcanizi söylemistik.
Simdi ise Smartyde her sayfada
$smarty->template_dir
$smarty->config_dir
$smarty->cache_dir
$smarty->compile_dir
bu degiskenleri yeniden doldurmamak icin basit bir sinif olusturup buna Smarty den miras almasini sagliyacagiz.
Böylelikle yeni yapmis oldugumuz Smarty sinifindan bir Instance (kopya) alip islemlerimize devam ede biliriz.

bunu SmartyTest.php adinda kaydedin

require_once('Smarty/libs/Smarty.class.php');
class SmartyTest extends Smarty{
function SmartyTest()
{
$this->Smarty();
$this->template_dir = 'Smarty/templates';
$this->compile_dir = 'Smarty/templates_c';
$this->config_dir = 'Smarty/configs';
$this->cache_dir = 'Smarty/cache';
}
}
böylelikle $this->template_dir,$this->compile_dir,$this->config_dir,$this->cache_dir
hepsi root klasörümüzde (html) Smarty klasörü icini gösteriyor.kullanim cok basit
require_once("SmartyTest.php");
$smarty = new SmartyTest;
...

Kolay gelsin sorunuz sora bilirsiniz.

Kategoriler: PHP

Etiketler:, Yorum yapın

Yorum yapın

Feed

http://www.skorp.eu / Smarty kullanimi