Thursday, May 22, 2014

Search Plugin Problem (?)

Model-----------------------------------------------------------------------------

<?php
App::uses('AppModel','Model');

class DetailData extends AppModel{

public $actsAs = array('Search.Searchable');
public $filterArgs = array('school_name'=> array('type' => 'value'),);


}

Controller---------------------------------------------------------------------

<?php
App::uses('AppController', 'Controller');

class DetailDatasController extends AppController {

    public $components = array('Paginator','Search.Prg');

public function beforeFilter(){

        parent::beforeFilter();

    }

     public function index(){

        $this->Prg->commonProcess();
        $this->paginate = array(
                'DetailData' =>
        array(
                'conditions' => array(
                        $this->DetailData->parseCriteria($this->passedArgs)
                )
        ));

        $this->DetailData->recursive = 0; 
        $this->set('detaildatas', $this->Paginator->paginate());

    }

}

View-----------------------------------------------------------------------
<!DOCTYPE html>
<html lang="ja">
<head>
</head>
<body>

    <?php foreach ($DetailData as $data):?>
    <table>
        <tr>
            <td>

                <?php echo $data['DetailData']['id'];?>
            </td>
            <td>
                <?php echo $data['DetailData']['school_name'];?>
            </td>
            <td>
                <?php echo $data['DetailData']['address'];?>
            </td>
        </tr>
    </table>
    <?php endforeach;?>

<?php

    echo $this->Paginator->counter(array('format' => '全%count%件' ));
    echo $this->Paginator->counter(array('format' => '{:page}/{:pages}ページを表示'));

    echo $this->Paginator->first('最初のページへ ', array(), null, array('class'=> 'first disabled'));
    echo $this->Paginator->prev(' < 前へ',array(), null, array('class' => 'prev disabled'));
    echo $this->Paginator->numbers(array('separator' => ' '));
    echo $this->Paginator->next(' 次へ >', array(), null, array('class'=> 'next disabled'));
    echo $this->Paginator->last(' 最後のページへ', array(), null, array('class'=> 'next disabled'));
    ?>

<!-- 検索 -->
<?php echo $this->element('searchForm'); ?>


</body>
</html>

Error-----------------------------------------------------------------------------------------

Database Error

Error: SQLSTATE[42000]: Syntax error or access violation: 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
----

It doesn't work. Plugin is Cake DC/Search.

Do you have any idea to solve this problem?



Hiroki Yamamoto




--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: