求助...smarty不能传值过去

#1 haoyouniuliu

我刚开始学习sp,下载了一个集成环境,想试一下smarty,但是模板里却怎么也显示不出来。我是按照留言本的例子设置的。index.php文件:
define("SP_PATH",dirname(__FILE__)."/SpeedPHP");
define("APP_PATH",dirname(__FILE__));
$spConfig = array(

'view'=>array(

'enabled'=>TRUE,

'config'=>array(

'template_dir'=>APP_PATH.'/tpl',

'compile_dir'=>APP_PATH.'/tmp',

'cache_dir'=>APP_PATH.'/tmp',

'left_delimiter'=>'<{',

'right_delimiter'=>'}>',

),

),
);
require(SP_PATH."/SpeedPHP.php");

main.php文件:
class main extends spController
{

function index(){

$abc = "Hello World";

$this->display("white/index.html");

}
}
?>

tpl/white/index.html文件:
<{$abc}>
生成的tmp目录下的文件:
         compiled from white/index.html */ ?>
_tpl_vars['abc']; ?>



但浏览器里就是什么也没有,这是怎么回事呢?

2011-05-07 19:07:30

#2 jake

main.php文件:
class main extends spController
{
function index(){
$this->abc = "Hello World";
$this->display("white/index.html");
}
}
?>
建议详细看看:
http://speedphp.com/view-smarty.html

2011-05-07 19:35:21

#3 haoyouniuliu

回复 2 jake


   出来了,谢谢jake

2011-05-07 20:31:32