0
我试图使用CakePHP Search Plugin以及食谱中提供的Blog tutorial,即使我按照指令继续收到此错误消息:警告(512):SQL错误:1064:你的SQL语法有错误;请检查与您的MySQL服务器版本相对应的手册,以获取在第1行处的'parseCriteria'附近使用的正确语法。CakePHP搜索插件存在问题
这是我做了什么:
型号:
class Post extends AppModel {
var $name = 'Post';
var $displayField = 'title';
public $filterArgs = array(
array('name' => 'title','type' => 'string'),
);
}
控制器:
class PostsController extends AppController {
var $name = 'Posts';
public $components = array('Search.Prg');
public $presetVars = array(
array('field' => 'title', 'type' => 'value'),
);
function beforeFilter() {
parent::beforeFilter();
}
public function index() {
$this->Prg->commonProcess();
$this->paginate = array(
'conditions' => $this->Post->parseCriteria($this->passedArgs));
$this->paginate = array('limit' => 15);
$this->set('posts', $this->paginate());
}
}
查看:
<?php
echo $this->Form->create('Post', array(
'url' => array_merge(array('action' => 'index'), $this->params['pass'])
));
echo $this->Form->input('title', array('div' => false, 'empty' => true));
echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();
?>
你知道为什么会发生这种情况吗?我错过了什么吗?