public static function init($viewtype, $configArr) { self::$view = new $viewtype(); foreach ($configArr as $key => $value) { self::$view->{$key} = $value; } }
/** * 实例化模板引擎 * @param string $viewtype 模板引擎类型 * @param array $config 模板引擎的配置信息,必须为关联数组 * @return [type] [description] */ public static function init($viewtype, $config) { self::$view = new $viewtype(); //此处为smartym模板引擎信息,格式为 //$smarty->left_delimiter='{<'; foreach ($config as $key => $value) { self::$view->{$key} = $value; } }
public static function init($viewtype, $config) { self::$view = new $viewtype(); /*$smarty = new Smarty();//实例化smarty $smarty->left_delimiter=$config["left_delimiter"];//左定界符 $smarty->right_delimiter=$config["right_delimiter"];//右定界符 $smarty->template_dir=$config["template_dir"];//html模板的地址 $smarty->compile_dir=$config["compile_dir"];//模板编译生成的文件 $smarty->cache_dir=$config["cache_dir"];//缓存*/ foreach ($config as $key => $value) { self::$view->{$key} = $value; } }
public static function init($viewtype, $config) { self::$view = new $viewtype(); /*$smarty = new Smarty();//ʵ����smarty $smarty->left_delimiter=$config["left_delimiter"];//���� $smarty->right_delimiter=$config["right_delimiter"];//�Ҷ����� $smarty->template_dir=$config["template_dir"];//htmlģ���ĵ�ַ $smarty->compile_dir=$config["compile_dir"];//ģ���������ɵ��ļ� $smarty->cache_dir=$config["cache_dir"];//����*/ foreach ($config as $key => $value) { self::$view->{$key} = $value; } }