0

WordPress に WP MVC を使用していますが、次の問題が発生しています。シナリオの例を次に示します。イベント index.php ページでユーザー検索機能を許可したいと思います。たとえば、すべてのイベントを会場または講演者別に検索して、会場と講演者のドロップダウンを表示できるようにしたいと考えています。events_controller.php の paginate 関数を使用してこれをどのように行うことができますか?

現在のコードは次のとおりです。 public function index() {

$this->params['page'] = empty($this->params['page']) ? 1 : $this->params['page'];

    $this->params['conditions'] = array('is_public' => true);

    $collection = $this->model->paginate($this->params);

    $this->set('objects', $collection['objects']);
    $this->set_pagination($collection);

}

この場合、どこにどのように参加しますか?

4

1 に答える 1

0

まず、会場とスピーカーを検索する必要があります。

//Paginating by venue id
$this->params['conditions']['venue_id'] = $venue_id; //example
$collection = $this->model->paginate($this->params);

//paginating by speaker id
$this->params['conditions']['Speaker.id'] = $speaker_id; //example
$collection = $this->model->paginate($this->params);
于 2013-04-16T16:28:13.270 に答える