刚学smarty犯了两个低级错误


刚学smarty犯了两个低级错误,记录下来,其中一个是没有初始化smarty,另外一个居然是没有定义变量,我按照phplib的模版来定义了,郁闷 "Fatal error: Call to a member function on a non-object in D:webworkswedding-rings.cnindex.php on line 3",这个便是没有初始化smarty了,我把变量的大小写搞错,"Fatal error: Smarty error: [in index.htm line 8]: syntax error: unrecognized tag 'Title' (Smarty_Compiler.class.php, line 590) in D:webworkswedding-rings.cnsmartySmarty.class.php on line 1095",这个便是我按照phplib模版的写法导致的错误
查找相关文章:smarty smarty fatal error
刚学smarty犯了两个低级错误,记录下来,
其中一个是没有初始化smarty,

 "Fatal error: Call to a member function on a non-object in D:webworkswedding-rings.cnindex.php on line 3",
smarty.php
<?php
require "smarty/Smarty.class.php";
define ('SiteRoot',"D:/web/works/wedding-rings.cn");
$Lang='en';
$Smarty=new Smarty();
$Smarty->template_dir = SiteRoot ."/templates/{$Lang}/";
$Smarty->compile_dir = SiteRoot ."/templates_c/{$Lang}/";
$Smarty->config_dir = SiteRoot ."/configs/";
$Smarty->cache_dir = SiteRoot ."/cache/";
$Smarty->left_delimiter = '<{';
$Smarty->right_delimiter = '}>';
?>

index.php(注意红色字体,小写了)
<?php
require "smarty.php";
$smarty->assign('Title',"测试页面");
$smarty->display("index.htm");
?>

"Fatal error: Smarty error: [in index.htm line 8]: syntax error: unrecognized tag 'Title' (Smarty_Compiler.class.php, line 590) in D:webworkswedding-rings.cnsmartySmarty.class.php on line 1095",
这个便是我按照phplib模版的写法导致的错误
模版中写成这样 <{Title}> 实际上应该这样 <{$Title}>