<html> <head> <title>{$title}</title> </head> <body> 本文:{$honbun} </body> </html>
require 'Smarty.class.php'; $tpl = new Smarty; $title = "てすと"; $tpl->assign("title",$title); $tpl->display("test.tpl");
function filter_pre($buff, &$tpl){ return mb_convert_encoding($buff,"EUC-JP","SJIS"); } function filter_post($buff, &$tpl){ return mb_convert_encoding($buff,"SJIS","EUC-JP"); } require 'Smarty.class.php'; $tpl = new Smarty; $tpl->register_prefilter('filter_pre'); $tpl->register_postfilter('filter_post');