Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have created a overriden taxonomy term page using views, page displays and attachment displays. A term landing page looks kind of like this:

  • 3 articles showing image as a list (page display)
  • 3 articles without showing image as a list (first attachment display)
  • 6 articles in 2 column table (second attachment display)

I would like to somehow enable paging on this thing. Ideally the pager would sit on the bottom of the last attachment. When a user goes to page 2 (assuming a page size of 12), the first (page display) view would show articles 13 to 16, the first attachment from 17 to 19 and so on.

Is this possible?

share|improve this question
add comment

2 Answers

If you're using Views 3:

While I don't know how to exactly do what you want purely with Views (or even if it's possible), I can suggest you a module called Display Suite which can work with Views. You can define different display modes for nodes first, and then go to Views and choose "Node Display" type of output, and define in the settings which article should be displayed with which display, for example First 3 nodes in the list should use "Teaser with Image" display, next 3 would use "Teaser without Image" display, and then the next 6 would use a normal "Teaser" display. Then you can use CSS to define the columns for the last 6. Doing it this way you eliminate having the need to use Attachments, so all your results come from 1 display. Pagers then should work normally. I cannot guarantee you this will work 100% as I haven't used this module by myself, but I've seen a colleague implement something like this before, and he also had problems with using Pagers. I'm not sure if this functionality is compatible with Views 2 as it's been a long time since I used Views 2. Good luck.

share|improve this answer
add comment

I've had success doing this with core taxonomy alone using a custom node-article-taxonomy.tpl.php template. That template has a var $id available which corresponds to the delta of a given node per page. So you can do something like this in that template:

<?php if ($id < 4) : ?>
  <?php // print your 3 articles showing image as a list ?>
<?php elseif (($id > 3) && ($id < 7)) : ?>
  <?php // print your 3 articles without showing image as a list ?>
<?php else : ?>
  <?php // print your 6 articles in 2 column table ?>
<?php endif; ?>

You'll have to manually print each of the fields or create new contexts/view modes for each of the three scenarios.

You'll also need to configure the "Number of posts on front page" variable (set on the Site Information page) to 12 as this dictates how many posts are shown on taxonomy pages too. By default, the form only allows you to set that value to 1-10, 15, 20, 25, 30 - so you'll have to use a hook_form_alter() or manually set that variable.

Terms with more than 12 nodes will automatically display the pager and page 2 will display nodes 13-24 using this method.

Note: These instructions are for Drupal 6. The template name might have changed slightly in D7.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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