You didn't follow the instructions correctly.
You have to attach a behavior to the Post model. From the very
beginning of the documentation you linked :
public $actsAs = array('Search.Searchable');
On May 16, 10:19 am, Alonso <[email protected]> wrote:
> Hi, folks.
>
> I've trying to use the CakePHP Search Plugin(http://cakedc.com/eng/
> downloads/view/cakephp_search_plugin) along with the Blog
> tutorial(http://book.cakephp.org/view/1528/Blog) available in the
> Cookbook and even though I followed the instruction to the letter I
> keep getting this error message :Warning (512): SQL Error: 1064: You
> have an error in your SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to use near
> 'parseCriteria' at line 1 .
>
> This is what I've done:
>
> **************************************Model:*****************************
>
> class Post extends AppModel {
> var $name = 'Post';
> var $displayField = 'title';
>
> public $filterArgs = array(
> array('name' => 'title','type' => 'string'),
> );
>
> }
>
> *************************************Controller:*******************************
>
> 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());
> }
>
> }
>
> *****************************************View:******************************************
>
> <?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();
> ?>
>
> Do you have any idea why this is happening? Am I missing something?
> Any suggestion will be appreciated.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php