I'm trying to build a view with a different number of items for the first page (2 items) than the others (3 items). How can I build it to avoid skipping items ?
I made tests using hook_views_pre_build()
but the result isn't conclusive as the second page will miss one item (item C):
Here is my current code:
function MYMODULE_views_pre_build(&$view) {
if ($view->name == 'my_view' && empty($_GET['page']) {
//The view normally has 3 items per page, put 2 for the first page.
$view->items_per_page = 2;
}
}
And here is the result I obtain:
First page:
- item A
- item B
Second page:
- item D
- item E
- item F
As you can see, item C
is missing because setting the number of items per page to 3 imply that the first page also has 3 items.
Is there another way to get this working ?