Jump to content

Recommended Posts

Posted

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!

Posted

Ok, I've read a lot of posts were they suggest to put "start=0" in your selector. But what if I want my first page to start not from the first element of the selector? Have I to slice the pageArray?

Posted

@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.

Posted

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.

  • 9 months later...
Posted

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

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
×
×
  • Create New...