CakePHPのSeachPluginを導入したのですが、うまく検索機能が働かず検索ボタンを押したところで同じページに再リダイレクトされてしまいます。
投稿title名またはusernameなどで検索を実装できればと考えてます。
現状のコードにアドバイスを頂戴したいです。
posts Table
id title message created deleted modified
users Table
id username email password
PostsController Controllerファイル public function search() { //$this->post->recursive = 0; $this->Prg->commonProcess(); $this->paginate = array( 'conditions' => $this->Post->parseCriteria($this->passedArgs),); pr($this->paginate());///////debug $this->set('posts', $this->paginate()); } ////////////////////////////////////////////////////////////////////////////////// Post.PHP Modelファイル <?php App::uses('AppModel', 'Model'); /** * Post Model * */ class Post extends AppModel { public $order = array('Post.id DESC'); public $actsAs = array('Search.Searchable'); public $filterArgs = array('id' => array('type' => 'value'), 'title' => array('type' => 'like'),); public $displayField = 'title'; } ?> コード
回答1件
あなたの回答
tips
プレビュー