[英]Why do I get a smarty notice “Trying to get property of non-object in …\sysplugins\smarty_internal_templatecompilerbase.php on line 348”?
I create my $smarty
object according to the Smarty manual and I get the following notice: 我根据Smarty手册创建了$smarty
对象,并得到以下通知:
Notice: Trying to get property of non-object in ...\smarty-3.1.32\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 348
What does this mean and how can I avoid it? 这是什么意思,我该如何避免?
This error message appears when you extend the Smarty class but from the new constructor you don't call the parent constructor. 扩展Smarty类时出现此错误消息,但是从新的构造函数开始,您不会调用父构造函数。 Do something like this in your child class: 在您的孩子课堂上做这样的事情:
class SmartyExtend extends Smarty {
function __construct() {
parent::__construct(); // this is the line that was missing
$this->setTemplateDir(...);
$this->setCompileDir(...);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.