cpԴģܼ򵥣Ҫ˳ģĸֵݣʹ÷£

һģüʵ

	//ģ
	$config['TPL_TEMPLATE_PATH']='./template/';//ģĿ¼
	$config['TPL_TEMPLATE_SUFFIX']='.html';//ģ׺һ㲻Ҫ޸
	$config['TPL_CACHE_ON']=false;//Ƿģ建棬true,false
	$config['TPL_CACHE_PATH']='./data/tpl_cache/';//ģ建Ŀ¼
	$config['TPL_CACHFILE_SUFFIX']='.php';//ģ建׺,һ㲻Ҫ޸
	//ģý
	
	require(CP_PATH.'core/cpTemplate.class.php');//ģ
	$tpl=new cpTemplate($config);//ʵģ



õķֻ
	1ģ帳ֵ
	$tpl->assign($name, $value);
	
		磺$tpl->assign('name', $name);
			$tpl->assign('user', $user);
			ģ崫ֵԭ	//ģ帳ֵ
					public function assign($name, $value)
					{
								$this->vars[$name] = $value;
					}
			$nameΪһ±꣬$valueΪԪصֵ
			//
			ͨextract($this->vars, EXTR_OVERWRITE);
			±ΪԪֵΪֵ
			$this->vars['name']='admin';$name='admin';

				
	2ģʾ		
	$tpl->display($tpl);
	
	磺$tpl->display('index/index');template/index/index.htmlģ
		$tpl->display('index');template/index.htmlģ
		
	ע:Ҫģ׺Ŀ¼$config['TPL_TEMPLATE_PATH']='./template/'Ŀ¼
		׺Ϊ$config['TPL_TEMPLATE_SUFFIX']='.html';趨ĺ׺
		cpĵһ,ԶģĹ
		$tpl->display();//Ӳȼ$tpl->display(ǰģ/ǰ);
	

	
ģǩҲֻµ
	1
	{$name}				Ϊ<?php echo $name;?>
	{$user['name']}		Ϊ<?php echo $user['name'];?>
	
	2ģڰͷײ	
	{include file="ģ"}	{include file="header"}
	
	ע⣺ܵݹǶincludeǩheaderģ,Ŀ¼$config['TPL_TEMPLATE_PATH']='./template/'Ŀ¼׺Ϊ$config['TPL_TEMPLATE_SUFFIX']='.html';趨ĺ׺


˵cpԴģƵúܼ򵥣ѭжϵԭphpȥʵ֡
ΪʲôcpģҪôأ
ΪڵĿԴϵͳУ󲿷ֶһԼģ棬ѧϰһϵͳҪȥѧϰһ
ģǩѧϰɱΪ˼ٴѧϰcpĳɱʰģƵúܼ򵥣һģҿȥʹsmarty