Внутри CakePHP 2 Я использую разбиение на страницы, которое отлично работает, пока не увижу URL-адрес, который является страницей: 2, как я могу это сделать? Page = 2?Проблемы с разбивкой по страницам CakePHP
Следующий вопрос заключается в том, что я использую этот код для своего контроллера, который поддерживает /domain.com/offers/top, /domain.com/offers/newest, /domain.com/offers/popular, а затем такие категории, как/domain.com/offers/tv-and-video. Дело в том, что он разбивается на страницы для /domain.com/offers/top вместо того, чтобы быть/предлагает/top/page: 2 он переходит в/offers/bycategory/top/page: 2.
public function bycategory($slug = null)
{
$userId = $this->Session->read("UserAuth.User.id");
if ($slug == 'top') {
//Get the top rated offers
$this->paginate = array(
'limit' => 15,
'order' => array(
'Offer.vote' => 'desc'
)
);
} elseif ($slug == 'newest') {
//Get the latest offers
$this->paginate = array(
'limit' => 15,
'order' => array(
'Offer.created' => 'desc'
)
);
} elseif ($slug == 'popular') {
//Get the most talked about offers
} else {
//This is the categories, so just get the category slug.
$this->paginate = array(
'conditions' => array('Category.slug =' => $slug),
'limit' => 15,
'order' => array(
'Offer.created' => 'desc'
)
);
}
$offers = $this->paginate('Offer');
// pass the value to our view.ctp
$this->set('offers', $offers);
$this->set('userId', $userId);
$this->render('/Offers/index');
}
Это мой пользовательский маршрут:
Router::connect(
'/offers/:catslug',
array('controller' => 'offers', 'action' => 'bycategory'),
array(
'pass' => array('catslug')
));
Не используйте для подбора этих целей цезификацию страницы. – Anubhav