0

我从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());



        }

在我的模型中:公共

$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');  

错误显示: 致命错误:在第 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);
    }

问题是什么?

4

1 回答 1

0

Croogo 捆绑的 cakephp 版本与搜索插件所期望的不匹配。要在 Croogo 1.4.3 中使用 Search 插件,您需要找出它正在使用的 CakePHP 版本,并为该特定版本的 CakePHP 下载正确版本的 Search 插件。

Croogo 1.4.3 真的很老了,比当前的稳定版本落后了 14 个版本。进行了很多改进,1.5.x 版已经默认支持搜索插件。我建议你升级到最新的稳定版。

于 2014-06-09T02:16:07.550 回答