smarty template fonksiyon çağırmak

smarty template de tpl içinde çalışırken php de bulunan fonksiyonumuza erişmek isteyebiliriz

index.php dosyası


/
tarihi türkiye tarih tipini veritabnındaki mysql formatlı tipe cevirir
@example tr2sql_DateTime("25-04-2014 15:40:15"); sonuc 2014-04-25 15:40:15
@param date $datetime
@param string $ayrac
@return string
*/
function tr2sql_DateTime($datetime, $ayrac = "-") {
$tarih = explode ( $ayrac, $datetime );
$tarih2 = explode ( " ", $tarih [2] ); // 17 02:13:53
return $tarih2 [0] . $ayrac . $tarih [1] . $ayrac . $tarih [0] . ' ' . $tarih2 [1];
}


index.tpl dosyası


{'25-04-2014 15:40:15'|tr2sql_DateTime:'-'}