Jump to content

Problems with pagination


verdeandrea
 Share

Recommended Posts

Hi guys,

am I doing something wrong?

I get this selector

$appuntamenti_privati = $pages->find("template=appuntamento_privato|appuntamento_cinema|appuntamento_cultura|appuntamento_gusto, start=11, limit=10, sort=-date, sort=title");

and then i get this at the end of the page

<?php echo $appuntamenti_privati->renderPager(); ?>

and i get a pagination rendered but it doesn't work correctly. 

I have only and always the "Prev"and it's always linked to page2 and, above all, every page shows always the same results (the first ten results).

I can't get were the problem is.

Thanks!

Link to comment
Share on other sites

@Soma: Yes, it's enabled.

@Hari KT:

I've tried also something like this

$news = $pages->get('/news/')->children('template=news, sort=-date'); 
$news_archive = $news->slice(8);
$news_archive = $news_archive->find("limit=10");
echo $news_archive->renderPager();

but it doesn't seem to work.

Link to comment
Share on other sites

Pager only works for single queries and not for arrays in memory or modified ones l. If you manipulate the arrangements after the find it doesn't work. You could set start limit and totals manually but then you'd have to load all first in a find without a limit. Works fine for smaller amounts.

Link to comment
Share on other sites

  • 9 months later...

I got the same problem, having a slider (carousel) with the first N pages, then the rest are listed below that (and paginated).

Using "start" screwed things up. However, getting pages to exclude first and then building up the pages to paginate worked:

$carouselItems = 2;
$itemsPerPage = 5;

// get page IDs to exclude
$carouselItemIDs = wire('pages')->find('limit=' . $carouselItems . ', sort=-publish_date')->id('|');

// get pages for pagination (without carousel pages)
$myPages = wire('pages')->find('id!=' . $carouselItemIDs . ', template=recipe, limit=' . $itemsPerPage . ', sort=-publish_date');
  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...