LoginSignup
0
0

More than 5 years have passed since last update.

記事一覧を取得する時、現在のページを含ませないように条件で指定する

Posted at

記事の個別ページに関連する記事を紐付けたい場合を想定。

関連する記事一覧を取得する時、現在のページを含ませないように条件で指定する。

$postIdには現在のページの記事IDが入るとする。

public function detail($postId = null) {
    $relatedPost = $this->Post->find('all', array(
            'fields' => 'Post.post_date, Post.title',
            'conditions' => array('Post.id !=' => $postId),
    ));

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0