0

I have two separate views 'now' and 'next', they both collectively must only have three items. Is there a way for them to share the same pager limit for example if the 'now' view has one item the 'next' view can only display two items as the pager limit is three.

  • How do you display them? Page and block? Attachments? Two blocks?.. – Mołot Feb 24 '14 at 14:25
  • They are displayed in two separate blocks – colinam1992 Feb 24 '14 at 14:36
  • So the answer is probably no - there is no logical connection between them. Of course there usually is a way to hack around limits like this, but it may be a bit complicated to implement it. – Mołot Feb 24 '14 at 14:40
  • I posted this question on stack-overflow and got a response saying it could be done by 'Then you can alter the second view and put limit and offset by checking the url and getting the page number of the 'now' view. – colinam1992 Feb 24 '14 at 14:43
  • Do you have any idea how to do that / – colinam1992 Feb 24 '14 at 14:43
1

If you want to create the blocks yourself, eg, not just via the Block UI and Views, you can hack it together with using various hooks available within Views.

First out the door, I could see using Views' standard block for the now View, but in the next block, using views_get_view_result() to look at the results of the now View and depending upon its result, eg, how many results there are, changing the pager of the next View to be whatever you want, in this case 1 or 2.

Note that this of course entails running the now View queries twice, so you could create custom blocks containing both Views and statically save the information to be shared across the Page but that introduces other ugliness.

And then if any of these Views are cached, another set of issues crops up.

So, as @molot has mentioned in comments, there is a bunch to think about here.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.