自学PHP刚学到Smarty,遇到了问题,不知道怎么办!哪位大侠来帮帮忙啊?!

[复制链接]
查看11 | 回复6 | 2011-10-16 06:20:55 | 显示全部楼层 |阅读模式
index.tpl文件已经放在了smarty/templates/目录下。index.tpl代码如下:!DOCTYPEHTMLPUBLIC\"-//W3C//DTDHTML4.01htmlheadmetahttp-equiv=\"Content-Type\"content=\"text/html;charset=gb2312\"titleSmarty/title/headbody{$hello}/body/htmlindex.php代码如下:?phprequire\'smarty/Smarty.class.php\';$samrty=newSmarty();$smarty-template_dir=\'smarty/templates/\';$smarty-compile_dir=\'smarty/templates_c/\';$smarty-config_dir=\'smarty/configs/\';$smarty-cache_dir=\'smarty/cache/\';$samrty-caching=FALSE;$hello=\"hello!\";$samrty-assign(\'hello\',$hello);$samrty-display(\'index.tpl\');?错误提示:Fatalerror:Uncaughtexception\'SmartyException\'withmessage\'Unabletoloadtemplatefile\'index.tpl\'\'inF:\\wamp\\www\\learn\\smarty\\sysplugins\\smarty_internal_templatebase.php:119Stacktrace:#0F:\\wamp\\www\\learn\\smarty\\sysplugins\\smarty_internal_templatebase.php(348):Smarty_Internal_TemplateBase-fetch(\'index.tpl\',NULL,NULL,NULL,true)#1F:\\wamp\\www\\learn\\index.php(11):Smarty_Internal_TemplateBase-display(\'index.tpl\')#2{main}throwninF:\\wamp\\www\\learn\\smarty\\sysplugins\\smarty_internal_templatebase.phponline119
回复

使用道具 举报

千问 | 2011-10-16 06:20:55 | 显示全部楼层
?phpinclude_once(\"./Smarty/Smarty.class.php\");//包含smarty类文件$smarty=newSmarty();//建立smarty实例对象$smarty$smarty-templates(\"./templates\");//设置模板目录$smarty-templates_c(\"./templates_c\");//设置编译目录$smarty-cache(\"./cache\");//缓存目录$smarty-cache_lifetime=0;//缓存时间$smarty-caching=true;//缓存方式$smarty-left_delimiter=\"{\";$smarty-right_delimiter=\"}\";$smarty-assign(\"name\",\"zaocha\");//进行模板变量替换$smarty-display(\"index.htm\");//编译并显示位于./templates下的index.htm模板?追问不行哦!错误提示还是一样!
回复

使用道具 举报

千问 | 2011-10-16 06:20:55 | 显示全部楼层
你看看路径是不是对
回复

使用道具 举报

千问 | 2011-10-16 06:20:55 | 显示全部楼层
可能是没找到模板,采用绝对路径试试看。
回复

使用道具 举报

千问 | 2011-10-16 06:20:55 | 显示全部楼层
你上网上找找大师兄的教程比着做做就是了
回复

使用道具 举报

千问 | 2011-10-16 06:20:55 | 显示全部楼层
如果能看懂smarty的运行原理的话,不用多久,动手试着做一次就学会了,但是更多更复杂的功能还是要参考smarty手册关于谈对象,可以找下【至尊恋爱秘籍-lover21】这套语音课程。我以前也很缺乏对女人的了解,我对女人的了解也很单纯,以为只要对她好,就能紧紧的攥住她的心,可实际却是,往往我对她越好,分的越快,我是不是太傻了。。。常找不到话题,每天都聊些重复的东西,尴尬又无聊,慢慢的自己都觉得累了。后来一高人推荐我听这个,听了才明明原来一直是自己在犯傻,和女人相处一下子变得太简单了!你自认为对她多好,她未必这么觉得,你得先懂女人怎么思考的,对她的好才能到她心里去。很多问题,其实都是心态问题。这么牛b的录音,要是听完还不会爱,那就真的没救了。2011-9-2723:45:52
回复

使用道具 举报

千问 | 2011-10-16 06:20:55 | 显示全部楼层
学习网页编程可以加入我的团队一天十二个小时在线,共同学习网页编程,扣扣:2,4,4,2,0,9,7,4,1,0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行