- return array(
'THINK_PLUGIN_ON' => true,
'TMPL_ENGINE_TYPE'=>'smarty',
- );
- $this->tpl = View::getInstance();
- static function getInstance() {
get_instance_of(__CLASS__,'init');
init ($type=''){
$type)) {
$this->type = strToUpper( $type );
$this->type = strtoupper(C('TMPL_ENGINE_TYPE'));
in_array( $this->type, array('PHP','THINK') ) ){
$type = ucfirst( strToLower( $this->type ) );
vendor( $type );
$type();
$this;
- return
- }
- public function
- if(!empty(
-
- }else{
-
- }
- if ( !
-
-
- return new
- }
- return
- }
- 切记切记:千万不可漏掉最后一句return $this;,其实这就是我所说的get_instance_of的BUG,如果不加这句,那么当type变量为PHP或THINK时,getInstance是无法返回实例的。
- return array(
'THINK_PLUGIN_ON' => true,
'TMPL_ENGINE_TYPE'=>'TpSmarty',
- );
- <?php
include_once(PLUGIN_PATH."smarty/Smarty.class.php");
TpSmarty extends Smarty {
__construct (){
parent::Smarty();
$this->caching = true;
$this->template_dir = TMPL_PATH;
$this->compile_dir = CACHE_PATH ;
$this->cache_dir = TEMP_PATH ;
?>
- class
- public function
-
-
-
-
-
- }
- }
- class IndexAction extends Action{
index(){
$this->assign('test','testss');
$this->display('default/index.html');
- public function
-
-
- }
- }