1

我对这个助手有疑问:https ://github.com/kshakirov/cakephp-lang-helper

这个助手给了我这个错误,我不知道为什么:

Fatal Error

Error: Call to a member function input() on a non-object
File: \app\View\Helper\LangHelper.php
Line: 670
4

2 回答 2

1

我猜问题是 LangHelper 覆盖了父__construct方法,阻止了 Cake 正确设置 Helper。将 LangHelper 更改__construct()为以下内容:

public function __construct(View $View, $settings = array()) {
    parent::__construct($View, $settings); 
    $this->mapper = $this->parseLangHeaders();
    $this->langCode = $this->findLangCode();
    $this->countryCode = $this->findCountryCode();
}
于 2012-11-08T01:51:54.307 回答
0

你在里面激活FormHelperAppController吗?

App::uses('FormHelper', 'View/Helper'); // Don't forget this one in Cake 2.x

class AppController extends Controller
{
  public
    $helpers = array('Form');
}
于 2012-11-07T23:35:57.590 回答