0

I need two view pagers / pagination to sandwich the view content or view results.

Is it possible to duplicate view pagers/pagination ?

What i've done is just printed out the pagers in the template twice; however, that requires me to hardcode the pager.

I need a little more flexibility because I'm required to build / place the top pager in different spots on different pages.

Could this be accomplished with views display (suite) somehow and a code field? I've attempted one and had no luck.

2
  • Not that Ive used it by this module apparently creates another display in your view 'Pager block' which will create a block for the pager.
    – Alex Gill
    Sep 20, 2013 at 11:05
  • What module are you referring to? Sep 20, 2013 at 11:28

2 Answers 2

0

I think you are on the right track by editing the views template files. Do you know you can have a different template for each view, or each views display? When you are editing your view there is a link called "theme information" that will help you figure out how to name the templates.

Now, If you mean you need to have the pager in different places on page 1 of this display vs page 2 of the same display, you will have to dig inside the view object to figure out which page you're on in order to figure that out.

I also found this tutorial while Googling the answer: http://www.adesignforlife.net/articles/drupal-tutorials/solution-how-print-pager-drupal-views-block

0

I've done this recently for a site. First, you wanna enable twig debugging. Write the file web/sites/development.services.yml with the following content:


parameters:
  http.response.debug_cacheability_headers: true
  twig.config:
    debug: true
    auto_reload: true
    cache: false
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory

This will give you hints about available template filenames, in the source code (ctrl+shift+C in the browser to view the source code). Then, in the appropriate template file which for me was templates/views/views-view.html.twig:


  {% if pager %}
    {{ pager }}
  {% endif %}
  {% if rows %}
    <div class="view-content row">
      {{ rows }}
    </div>
  {% elseif empty %}
    <div class="view-empty">
      {{ empty }}
    </div>
  {% endif %}
  {% if pager %}
    {{ pager }}
  {% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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