终于知道smarttemplate的例子怎么运行了
(2006-10-11 10:50:19)
早就下载了smarttemplate,可是 一直不知道怎么去用。
郁闷死我了。
一个月前曾经用了两天时间上网查和smarttemplate有关的资料,还上国际喜悦村问些"高手",可是都没结果。
今天晚上干脆直接上了[url]www.smartphp.net[/url],找了会没找到,就进了他们的forum,查了一会儿也没找到,就直接搜了一下,最后终于如愿以尝了。
详细过程请看全文吧
直接下载的smarttemplate是一个smarttemplate_1_0_2.zip压缩包。
解压缩后的文件夹smarttemplate_1_0_2里有五个文件: class.smarttemplate.php, class.smarttemplatedebugger.php, class.smarttemplateparser.php, readme.txt,changes.txt和三个文件夹examples,smarttemplate_compiled,smarttemplate_extensions.
大家开始注意了,这时候如果直接去看examples里面的例子的话,你会得到下面的错误提示:
比如说运行examples/basic/Alternating_Colors.php,错误提示为:
Warning: main(class.smarttemplate.php) [function.main]: failed to open stream: No such file or directory in E:\phpweb\smarttemplate_1_0_2\examples\basic\Alternating_Colors.php on line 3
Fatal error: main() [function.require]: Failed opening required 'class.smarttemplate.php' (include_path='.;C:\php5\pear') in E:\phpweb\smarttemplate_1_0_2\examples\basic\Alternating_Colors.php on line 3
原因是什么呢?大家仔细看这句:" No such file or directory in E:\phpweb\smarttemplate_1_0_2\examples\basic\Alternating_Colors.php on line 3"。
好的,我就打开Alternating_Colors.php ,第三行内容为: require_once "class.smarttemplate.php";
这下就明白了,在basic目录下是没有class.smarttemplate.php这个文件的,class.smarttemplate.php是在解压后的文件夹里,所以就把第三行改成 require_once "../../class.smarttemplate.php。
好再运行Alternating_Colors.php,咦,又出现如下错误:
Warning: fopen(/temp/Alternating_Colors_html.php) [function.fopen]: failed to open stream: No such file or directory in E:\phpweb\smarttemplate_1_0_2\class.smarttemplateparser.php on line 206
SmartTemplate Compiler Error: Could not write compiled file
一个月以前我就是被这个问题搞的晕晕的,查了好长时间也没找到原因。今天晚上在smarttemplate的官方网站[url]www.smartphp.net[/url]的forum里找到了答案。问题就出在class.smarttemplate.php里面,大家找到第51行, 默认为var $temp_dir = '/temp/';我们改为 var $temp_dir = './temp/';并分别在example文件夹的三个子文件夹basic,control_structures,extensions里创建文件夹temp(如果你觉的这样太麻烦,你可以不更改var $temp_dir = '/temp/',在你的smarttemplate_1_0_2文件夹所在的盘比如D盘下,建立文件夹temp也行)。这时你再运行examples/basic/Alternating_Colors.php,OK,一切正常了。
呵呵,1号回家,找印点用smarttpl开发的源文件回家研究一寒假,开学就可以用smarttpl来开发我的随心文章系统了。
忘了告诉大家一声,我自己用半个月的时间写的随心文章系统已经完工了。等买了域名和空间就放上去。呵呵,希望大家能够关注呀。
PS:
刚才忘了说了,按照上面的做了以后,examples下面的extension里面的文件还是不有正常运行,原因我估计和文件夹smarttemplate_extensions里面的东西有关,具体原因今天晚上就不找了,明天再弄
分享:
喜欢
0
赠金笔
加载中,请稍候......
评论加载中,请稍候...
发评论
登录名: 密码: 找回密码 注册记住登录状态
昵 称:
评论并转载此博文
发评论
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。