1

I am looking for how to add pager in the complex set of view content. In my case, - I have 5 views with different titles, and have 10 items in each views. - Now, I want to divide each view in 2 pages, so 5 items on each page, so that 5 views will have 10 pages in sum. - and these all 10 pages has to be connected by single pager 1,2,3....10. - So on Page-1 View-1 title and its 1stpage and on Page-2 same title and half content of View-1 as described above (5+5). - and on Page-2 Views-2 with its title and on Page-3 views-2 title and half content of Views-2.. - So, on till views 5. (Please see First image for easy understanding)

View-arrangement

Now, what I tried, (1) I added views in views using Views field view module, So I had Main Views which have that 5 views as field and can set 1 item(1 view) per page, so each view will go on each page, but again for dividing each that inside view/sub-view in 2 parts I have to add pager to that each 5 views with 5 items,....So on in the final product MainView(inside Sub-view) will have two pagers....I tried and attaching the Screenshot in the second image.

Double pager

And Second point, Probably everybody would have seen the Drupal Documentation section of drupal.org. At the bottom the following type of PAGER (shown in attached image- 3) which allow the shift from one topic to other topic. Will it be possible in the above case. enter image description here

  • will these views stay in the same order? – No Sssweat Feb 16 '16 at 23:16
  • Yes it is like chapter-1, chapter-2....so on, so has to be in precise order... – CodeNext Feb 16 '16 at 23:18
  • Have you worked with views template files before? – No Sssweat Feb 16 '16 at 23:20
  • I guess I have not worked, I am very new to Drupal and have learned just how to display content using views and how to add views in views....if that way wherever you are describing can be done, I am ready to try. – CodeNext Feb 16 '16 at 23:23
1

Create 10 different page views. Example:

In Page View1 click on add page

enter image description here

In your view pager, select Display specified number of items.

Then add an offset of 5 (so your view will start from row 6)

enter image description here

If you're going to make changes to anything make sure you select this page override, otherwise it will make changes to all your page views. (On previous screenshot, see my pager options, I forgot to do that. Should be this page override)

enter image description here

On your footer Add Global text area. (remember this page override)

Then use html to create your own pager. (this is for view 2)

<a href="/view1">1</a> <b>2</b> <a href="/view3">3</a> .... <a href="/view3">Next ></a> <a href="/view10">Last >></a>

Then change code accordingly for view 3. (remember this page override)

Now we will need to hide the real pager.

Under Advanced, click on theme info. Then click on Display Output and copy the entire code that's there.

Create a new file and paste the code there.

Now find and delete the <?php print $pager; ?> line.

Now rename the new file to views-view--[view name goes here]--page.tpl (In my case my view is called sadfsafd)

Note: Do not use views-view.tpl.php as your template name, because that will affect all of your views, and we don't want that. By using views-view--sadfsafd--page.tpl I am only affecting the sadfsafd view.

Then upload views-view--[view name goes here]--page.tpl to your sites/all/themes/template folder.

Now clear/flush Drupal cache.

enter image description here

  • Hmmm, this is perfect. I tried it. it is like create a one view and add another 9 pages of view to it and set the starting content by selecting appropriate Offset with override in the pager so everything gets lined up till page 10. So 10 views with 10 paths and the customized pager will have link for each view in one line in footer 1....10. So, all 10 views get connected by that pager. Just correct me whether I understood right. Very Thanks. – CodeNext Feb 17 '16 at 16:49
  • @codenext yup, you got it. – No Sssweat Feb 18 '16 at 0:00

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.