Cakephp国家帮手

时间:2012-11-07 22:34:02

标签: cakephp formhelper

我对此助手有疑问: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

2 个答案:

答案 0 :(得分: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();
}

答案 1 :(得分:0)

您是否激活了FormHelper中的AppController

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

class AppController extends Controller
{
  public
    $helpers = array('Form');
}