Class: myTemplate

模版解析:
$tpl->init($setting, $cache, $allow_script)                 // Set the Template Class
$tpl->setTplPara($setting)                                  // Set the parameter of templatee
$tpl->setCacheMode($cache)                                  // Set the mode of template cache
$tpl->getTemplate($file1, $file2)                           // Get template content
$tpl->setLoop($key, $value, $fullset)                       // Set values for loop-blocks (in turn or batch)
$tpl->setIf($key, $value)                                   // Set the judging conditions for if-blocks
$tpl->setSwitch($key, $value)                               // Set the switch conditions for switch-blocks
$tpl->assign($name, $value)                                 // Set value for one variable
$tpl->loadSet($file, $prefix)                               // Read Batch setting file
$tpl->removeCache()                                         // Remove template complied cache
$tpl->regTag($tag_name, $tag_func)                          // Regist tag-parser for the custom tags
$tpl->getBlock($tpl_content, $tag, $idx)                    // Analysis a custom tag
$tpl->checkCache()                                          // Check if the current template with the define idx has been cached as a static html file
$tpl->getCache()                                            // Directly get file content from cached html file
$tpl->render($global_vars)                                  // Get result content compile by the template engine ('$global_vars' ara the parameters needed in php cache file)
1 init
     * 变量初始化
     * @param $setting
     * @param false $cache
     * @param false $allow_script
     * @param null $delimiter
     
2 setTplPara
     * 设置模版参数
     * @param $setting
     * @return $this
     
3 setCacheMode
     * 设置缓存模式
     * @param $cache
     * @return $this
     
4 getTemplate
     * 获取模板文件代码
     * @param $file1
     * @param string $file2
     * @return string
     
5 setLoop
     * 设置循环变量
     * @param $key
     * @param $value
     * @param bool $fullset
     * @return $this
     
6 setIf
     * 设置判断变量
     * @param $key
     * @param bool $value
     * @return $this
     
7 setSwitch
     * 设置选择变量
     * @param $key
     * @param bool $value
     * @return $this
     
8 assign
     * 设置普通变量
     * @param $name
     * @param $value
     * @return $this
     
9 loadSet
     * 读取批量设置文件
     * @param $file
     * @param string $prefix
     * @param bool $mode
     * @return $this
     
10 compileTemplate
     * 模版缓存编译
     * @return bool|mixed|null|string|string[]
     
11 removeCache
     * 删除模版编译缓存
     * @return mixed
     
12 parseBlock
     * 解析模版功能模块
     * @param $attrib
     * @param $content
     * @param $block_attrib
     * @param $block_content
     
13 regTag
     * 添加标签解析方法
     * @param $tag_name
     * @param string $tag_func
     * @return mixed
     
14 parseTag
     * 解析自定义标签
     * @param $content
     * @return mixed
     
15 getBlock
     * 获取自定义标签相关信息
     * @param $tpl_content
     * @param string $tag
     * @param string $idx
     * @return array
     
16 checkCache
     * 检测模版缓存是否存在
     * @return bool
     
17 getCache
     * 取得已编译模版缓存
     * @return string
     
18 render
     * 获取最终超文本页面内容
     * @param string $global_vars
     * @param bool $tpl_show
     * @param bool $minify
     * @return mixed|string
     
19 __construct
     * 通用构造方法,转移到 init 方法
     
20 setErrHandler
     * 设置错误处理函数
     * @param $func
     
21 error
     * 通用错误处理方法
     * @param $msg
     * @param bool $exit
     * @return bool