I'm trying to create a pager in Views from content structured by entity reference fields.

I have content Types Stories and Chapters. Chapters reference Stories so you have multiple Chapters organized per story. They chapters are sorted by an integer field in Chapter as Chapter number so it goes.

stories/Story ID(SID/Chapter ID(CID).

Now, part of my navigation is a drop down menu that shows all chapters that reference the same story sorted by chapter number.

What I need is the next/prev pager links that go one foreward and one back. I could use some help figuring this out if anyone has any ideas on this. I'm not sure how to create that part of it.

  • 1
    Can you clarify: are you trying to use the Views pager, or are you creating your own pager? Views automatically creates your pager nav for you, but you mention a drop down menu which is not part of the Views pager. – longboardnode Oct 19 '15 at 1:25
  • I'm basically creating my own pager/nav block in views. The Block includes a drop down jump menu that lists all the chapters in a story and sends you to the chapter you choose when you select it. I need the Next and Prev links now though to go through it back and forth one chapter. I'm using FreePager right now for this functionality, but it seems to me to be something you should be able to do in VIews as a regular pager or just creating two links. I just don't know how to do it. – CW Smith Oct 19 '15 at 2:06
  • FWIW you should be able to duplicate the links on the Views' pager. Looking at any of the system views, such as the content page /admin/content or admin/people, you will see the pager views are all structured in a certain way, for example the content pager next link is /admin/content?title=&type=All&author=&status=All&vid=All&nid=&page=1 so I believe you should be able to just add page=1, page=2 etc for next (then add the various filtering options)... – longboardnode Oct 19 '15 at 2:39
  • That MIGHT work, I'll give it a shot. But what about the prev link then? – CW Smith Oct 19 '15 at 23:03
  • Let me know if the next works... Prev should be the same setup as the Views prev link, but you probably will need some php code to hide the link if the pager is on the first page – longboardnode Oct 20 '15 at 13:05

Your Answer

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

Browse other questions tagged or ask your own question.