cakephp2.×にて、findで、followを検索し、
その後、$this->Paginator->settingsにて、
$all_followにて抽出したfollowを
'conditions'条件に入れたいのですが、
上手く行かず困っています。
$all_followのdebug結果
array(
(int) 0 => array(
'Follow' => array(
'follow' => 'tera'
)
),
(int) 1 => array(
'Follow' => array(
'follow' => 'terarail'
)
)
)
$all_follow[1]['Follow']['follow']とすれば、表示されるのですが、
findの配列に入っている条件によってPaginatorの表示を変えたい
PHP
1public function index($data_name=NULL){ 2 $this->loadModel('Tweet'); 3 $this->loadModel('Follow'); 4 $this->set('user', $this->Auth->user()); 5 $this->set('data_name',$data_name); 6 $id = $this->Auth->user('username'); 7 $all_follow=$this->Follow->find('all',array('fields' => array('Follow.follow'),'conditions'=>array('Follow.follow'=>$id))); 8 9 $this->Paginator->settings = array( 10 'order' => array('Tweet.tweettime' => 'desc'), 11 'limit' => 10, 12 'conditions'=>array('Tweet.name = $all_follow['Follow']['follow']) 13 ); 14 15if($data_name==$id){ 16 $this->set('Tweet_all',$this->Paginator->paginate('Tweet')); 17 $this->set('follow_data',$this->Follow->find('all',array('conditions'=>array('Follow.follow'=>$id)))); 18 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/10/09 04:33
2016/10/09 04:58 編集
2016/10/09 05:14
2016/10/09 05:20
2016/10/09 05:35
2016/10/09 06:18 編集
2016/10/09 08:07 編集