php smarty前后台模板路径的配置问题

2025-01-04 14:26:43
推荐回答(2个)
回答1:

$smarty=new
smarty;
$smarty->template_dir=base_path.smarty_path."templates/";
$smarty->compile_dir=base_path.smarty_path."templates_c/";
$smarty->config_dir=base_path.smarty_path."configs/";
$smarty->cache_dir=base_path.smarty_path."cache/";
//定义定界符
$smarty->left_delimiter='<{';
$smarty->right_delimiter="}>";
$smarty2
=
new
smarty;
$smarty->template_dir=front_path.smarty_path."templates/";
$smarty->compile_dir=front_path.smarty_path."templates_c/";
$smarty->config_dir=front_path.smarty_path."configs/";
$smarty->cache_dir=front_path.smarty_path."cache/";
//定义定界符
$smarty->left_delimiter='<{';
$smarty->right_delimiter="}>";
不一定几套,
你想弄几套都行,你只要为你实例化的smarty对象做相应的设置就行啦。

回答2:

$smarty=new smarty;
$smarty->template_dir=base_path.smarty_path."templates/";
$smarty->compile_dir=base_path.smarty_path."templates_c/";
$smarty->config_dir=base_path.smarty_path."configs/";
$smarty->cache_dir=base_path.smarty_path."cache/";
//定义定界符
$smarty->left_delimiter='<{';
$smarty->right_delimiter="}>";

$smarty2 = new smarty;
$smarty->template_dir=front_path.smarty_path."templates/";
$smarty->compile_dir=front_path.smarty_path."templates_c/";
$smarty->config_dir=front_path.smarty_path."configs/";
$smarty->cache_dir=front_path.smarty_path."cache/";
//定义定界符
$smarty->left_delimiter='<{';
$smarty->right_delimiter="}>";

不一定几套, 你想弄几套都行,你只要为你实例化的smarty对象做相应的设置就行啦。