我有一个很好的功能搜索工具,目前使用cakeDC搜索插件。我可以用分页进行很好的搜索。搜索不工作页面:2使用cakeDC搜索插件
我在这里的问题是,当我从页面搜索:2它根本没有。
这里是我的代码:
客户模式
public $actsAs = array('Search.Searchable');
public $filterArgs = array(
'searchTerm' => array(
'type' => 'like',
'field' => array('Customer.name', 'Customer.mobile', 'Customer.address'),
'filter' => array('type' => 'query', 'method' => 'orConditions')
)
);
public function orConditions($data = array()) {
$filter = $data['filter'];
$cond = array(
'OR' => array(
'Customer.name LIKE' => '%' . $filter . '%',
'Customer.mobile LIKE' => '%' . $filter . '%',
'Customer.address LIKE' => '%' . $filter . '%',
));
return $cond;
}
CustomersController
public $components = array('Paginator', 'Session', 'Search.Prg');
public $presetVars = true;
public function index() {
$this->Prg->commonProcess();
$this->paginate = array();
$conditions = $this->Customer->parseCriteria($this->passedArgs);
$this->Customer->recursive = 0;
$this->paginate = array(
'limit' => 5,
);
$this->set('customers', $this->paginate($this->modelClass, $conditions));
$this->set('model', $this->modelClass);
}
index.ctp
<?php echo $this->Form->create() ?>
<?php echo $this->Form->input('searchTerm', array('class' => 'form-control','placeholder' => 'search for customer', 'label' => FALSE,'url' => array_merge(array('action' => 'index'), $this->params['pass']))); ?>
<?php echo $this->Form->end() ?>
Error: The requested address '/KPautos/products/index/page:2?searchTerm=j' was not found on this server.
搜寻工作不页:2 ...
任何帮助将衷心appritiated ...谢谢你提前
你能不能显示你的代码?如何搜索? – Sadikhasan 2014-09-25 10:27:46
你没有任何第2页searchTerm'j',你可以重定向用户回搜索这样的案例 – Abhishek 2014-09-25 11:12:20
@Sadikhasan我编辑了我的问题,并提供了搜索代码....实际上我已经使用cakeDC搜索插件。 – 2014-09-26 03:29:37