未定义属性:查看:: $ Js

时间:2012-02-03 19:13:08

标签: cakephp

得到这个。网站在本地工作正常,但在生产服务器上我收到此错误。

cakephp verion 1.3

制作:php 5.3.3-7 + squeeze7 开发:5.3.3-7 + squeeze3

Notice (8): Undefined property: View::$Js [APP/views/layouts/default.ctp, line 31]
Code | Context

include - APP/views/layouts/default.ctp, line 31
View::_render() - CORE/cake/libs/view/view.php, line 736
View::renderLayout() - CORE/cake/libs/view/view.php, line 494
View::render() - CORE/cake/libs/view/view.php, line 440
Controller::render() - CORE/cake/libs/controller/controller.php, line 909
ErrorHandler::_outputMessage() - CORE/cake/libs/error.php, line 458
ErrorHandler::missingComponentFile() - CORE/cake/libs/error.php, line 415
Object::dispatchMethod() - CORE/cake/libs/object.php, line 112
ErrorHandler::__construct() - CORE/cake/libs/error.php, line 125
Object::cakeError() - CORE/cake/libs/object.php, line 201
Component::_loadComponents() - CORE/cake/libs/controller/component.php, line 216
Component::init() - CORE/cake/libs/controller/component.php, line 78
Controller::constructClasses() - CORE/cake/libs/controller/controller.php, line 483
CakeErrorController::__construct() - CORE/cake/libs/error.php, line 52
ErrorHandler::__construct() - CORE/cake/libs/error.php, line 90
Object::cakeError() - CORE/cake/libs/object.php, line 201
Component::_loadComponents() - CORE/cake/libs/controller/component.php, line 216
Component::init() - CORE/cake/libs/controller/component.php, line 78

Fatal error: Call to a member function writeBuffer() on a non-object in /var/www/website.local/views/layouts/default.ctp on line 31 

第31行是

echo $this->Js->writeBuffer(array('cache'=> true));

我有app_controller.php

<?php

class AppController extends Controller {

        var $helpers = array('Html','Form','Session','Js','Javascript');
        var $components = array(
                        'Session',
                        'RequestHandler',
                        'DebugKit.Toolbar'
                );
}

?>

1 个答案:

答案 0 :(得分:0)

看起来你错过了一个组件文件:

ErrorHandler::missingComponentFile() - CORE/cake/libs/error.php, line 415

您可能希望首先探索该错误,然后查看它是否修复了您的其他问题。