我从http://www.cakedc.com/downloads下载了一个搜索插件。我用了cakephp / croogo 1.4.3。
我重命名了搜索插件'搜索'我在app/Plugin/
下载。
在我的控制器中:
public $name = 'MovementsRouts';
public $components = array('Search.Prg');
public $presetVars = array(
array('field' => 'name', 'type' => 'value'),
array('field' => 'status', 'type' => 'value'),
);
public function admin_index_route() {
$this->set('title_for_layout', __('Movement Taxi route'));
$this->MovementsRout->recursive = 0;
$this->Prg->commonProcess();
$this->paginate = array(
'MovementsRout' => array(
'conditions' => $this->MovementsRout->parseCriteria($this->passedArgs),
//'conditions' => array('MovementsRout.type_mvt ='=>'route_taxi'),
//'fields'=>array('id','description','title','support_count','oppose_count','user_id','created'),
'limit' => 5,
//'paramType' => 'querystring'
));
$this->set('movementsRouts', $this->paginate());
}
在我的模型中:public
$name = 'MovementsRouts';
public $components = array('Search.Prg');
public $presetVars = array(
array('field' => 'name', 'type' => 'value'),
array('field' => 'status', 'type' => 'value'),
);
在我看来index_route.ctp
:
<div><?php
echo $this->Form->create('MovementsRout', array(
'url' => array_merge(array('action' => 'index'), $this->params['pass'])
));
echo $this->Form->input('name', array('div' => false, 'empty' => true)); // empty creates blank option.
echo $this->Form->input('status', array('label' => 'Status', 'options' => $statuses));
echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();
?>
</div>
我添加了config/bootstrap
:
CakePlugin::load('Search');
错误显示:致命错误:Class&#39; Hash&#39;在第85行的C:\ xampp \ htdocs \ wfs \ app \ Plugin \ Search \ Controller \ Component \ PrgComponent.php中找不到
在app \ Plugin \ Search \ Controller \ Component \ PrgComponent.php的第85行:
$this->_defaults = **Hash**::merge($this->_defaults, array(
'commonProcess' => (array)Configure::read('Search.Prg.commonProcess'),
'presetForm' => (array)Configure::read('Search.Prg.presetForm'),
), $settings);
}
有什么问题?
答案 0 :(得分:0)
Croogo捆绑的cakephp版本与Search插件所期望的版本之间存在不匹配。要在Croogo 1.4.3中使用搜索插件,您需要找出它使用的CakePHP版本,并为该特定版本的CakePHP下载正确版本的搜索插件。
Croogo 1.4.3真的很老了,目前稳定版后面有14个版本。很多已经改进,版本1.5.x默认支持搜索插件。我建议你升级到最新的马厩。