新手学习smarty 总是出现错误码

haibinnet 2012-03-31 05:50:25
我做的自定义函数,plugins文件夹下的function.函数名.php 里面定义的函数是smarty_function_函数名($参数,&$smarty){函数体} 在做模板中引用<{函数名 ...}> 为什么总是提示我一堆看不懂的错误
Fatal error: Smarty error: [in php3.tpl line 1]: syntax error: unrecognized tag 'haibincn' (Smarty_Compiler.class.php, line 590) in D:\myev\apache\htdocs\smarty\libs\Smarty.class.php on line 1095

haibincn为我定义的标签 我用注册的方式都可以通过


另外请高手指点一下 我的smarty 第一次总都是出错
Warning: strftime() [function.strftime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in D:\myev\apache\htdocs\smarty\libs\Smarty_Compiler.class.php on line 400
按F5刷新后不会出现上面的错误码 但改了模板后 双会出现!!!

求高手大虾米指点 谢谢
...全文
112 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
代码如诗 2012-03-31
  • 打赏
  • 举报
回复
syntax error 语法错误
unrecognized tag 'haibincn' 模板文件里的变量前面没加上 $, 改成 $haibincn
jdgdf566 2012-03-31
  • 打赏
  • 举报
回复
一般不要自定义函数。通常解决你的问题用smarty提供的功能足够了。
haibinnet 2012-03-31
  • 打赏
  • 举报
回复
谢谢 真的是加上就不对错了

上面那个问题可以回一下吗 谢谢了
代码如诗 2012-03-31
  • 打赏
  • 举报
回复
使用时间函数的时候没有设置好时区,在文件前面 写上 date_default_timezone_set('UTC');
最好把它写到公共文件里面

4,250

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧