zend framework和smarty整合,关于在模板中调用php对象

xuyijarson 2010-08-03 10:15:40
问题是这样是:我把zend framework和smarty整合到一起,我在类的代码中是这么写:$fp = new FormProcessor_UserRegistration($this->db); $this->view->fp = $fp;
在模板中是 $fp->hasError(); 程序运行时出现错误:
日志中的记载是:
[Tue Aug 03 09:53:34 2010] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function hasError() on a non-object in G:\\www\\phpweb20\\data\\tmp\\templates_c\\%%EB^EB0^EB0DA243%%register.tpl.php on line 15
[Tue Aug 03 09:53:34 2010] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in G:\\www\\phpweb20\\include\\Zend\\Controller\\Dispatcher\\Standard.php:194\nStack trace:\n#0 G:\\www\\phpweb20\\include\\Zend\\Controller\\Front.php(920): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))\n#1 G:\\www\\phpweb20\\htdocs\\index.php(34): Zend_Controller_Front->dispatch()\n#2 {main}\n thrown in G:\\www\\phpweb20\\include\\Zend\\Controller\\Dispatcher\\Standard.php on line 194, referer: http://phpweb20/account/register
[Tue Aug 03 09:53:35 2010] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in G:\\www\\phpweb20\\include\\Zend\\Controller\\Dispatcher\\Standard.php:194\nStack trace:\n#0 G:\\www\\phpweb20\\include\\Zend\\Controller\\Front.php(920): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))\n#1 G:\\www\\phpweb20\\htdocs\\index.php(34): Zend_Controller_Front->dispatch()\n#2 {main}\n thrown in G:\\www\\phpweb20\\include\\Zend\\Controller\\Dispatcher\\Standard.php on line 194, referer: http://phpweb20/account/register
...全文
184 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
coffeelet 2010-08-19
  • 打赏
  • 举报
回复
根据报错,这个程序至少有两个问题,
1 没有指定error控制器
2 smarty赋值错误,试试
$this->view->assign(‘fp’,$fp);

4,250

社区成员

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

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