나는 cakephp 2+ 프로젝트에서 일하고 있습니다. 두 개의 왼쪽 및 오른쪽 div 조합으로 제품 목록 정렬을위한 페이지 매김을 구현 중입니다. 왼쪽 div를 만들 수 있지만 오프셋이 페이지 매김으로 설정 될 수 없으므로 오른쪽 div를 만들 수 없습니다. 왼쪽 div에 절반 항목이 필요하고 오른쪽 div에 절반 항목이 필요하므로 한계를 설정할 수는 있지만 상쇄 할 수는 없습니다. 내가 어떻게 할 수 있니?Cakephp 오른쪽 div 조합으로 페이지 매김
Controller code
public function index()
{
$rows=$this->Product->find('count', array('conditions'=>array('Product.allow'=>1)));
if($rows%2==0)
{
$this->paginate = array('conditions' => array('Product.allow'=>1,'limit'=>($rows/2));
$list_l = $this->paginate('Product');
$this->set('left_list',$list_l);
$this->paginate = array('conditions' => array('Product.allow'=>1,'limit'=>($rows/2), 'offset'=>$rows/2));
$list_r = $this->paginate('Product');
$this->set('right_list',$list_r);
}
else
{
$right_list=$this->Paginate('Product', array('Product.allow'=>1),array('limit'=>($rows-round($rows/2)), 'offset'=>round($rows/2)));
}
}
View Code
Foreach loop with array returned from controller
정말 정확한 답장을 보내 주셔서 감사합니다. 거의 끝났습니다 ...... 나중에 참조 할 코드를 거의 넣을 것입니다 ......... 다시 한번 감사드립니다. 내 repu가 아직 이것을 허용하지 않으므로 죄송합니다. –