1

Hi and thanks for take the time to read this post.

(I want to know if exist some hook or User Interface way to make this)

I have two content types (content type X and content type Y), and I want to build one view that have the nodes of content types X and Y, but that shows always sticky items for X content type per each paginated page.

For example: the view will show 10 items per page.

to the first page --> the first 3 items will have positions 1,2,3 to X content type nodes, and the last positions 4,5,6,7,8,9,10 will have Y content type nodes.

to the second page --> the first 3 items will have positions 11,12,13 to X content type nodes, and the last positions 14,15,16,17,18,19,20 will have Y content type nodes.

I am reviewing modules like Nodequeue or Weight but I can not understand how to reach this using this modules (i think that this is a useful way with nodequeue: http://www.absolutecross.com/tutorials/drupal/custom-re-ordered-front-page-teasers but my question about how to sort automatically in the required way still is pending)

I must say that I have some aproximation to resolve this using a php snippet in one page: I use one pagination control that handle a SQL query with all results (all content types needed), and the other two SQL queries will call the respective quantity of data to each kind of content type (the sum of results of all individual queries, must be the number in the respective pagination parameter)...it works, but, like I already indicated, I want to know if exist some hooks way, or User Interface way, to make this because I will use several exposed filters that will change SQL queries.

Thanks in advance.

3
  • Does every page show X nodes 1-3? Or does page two show X nodes 4-6, page three shows X nodes 7-9, etc. Aug 9, 2011 at 17:51
  • hi rocketeerbkw, the answer to your question is yes. first page shows X nodes 1-3, second page X nodes 4-6, three X nodes 7-9. thanks for your question, to be more clear.
    – cigotete
    Aug 9, 2011 at 18:10
  • more information: I am using Drupal 6 and views 2.
    – cigotete
    Aug 9, 2011 at 18:34

1 Answer 1

0

First off, this can all be done in views, no custom code required (yay!). This is accomplished by creating an attachment view which will inherit the pager settings.

First you create a view with a page display that shows 7 Y nodes only.

Second, on the same view, add an attachment display. For the attachment, set it to show 3 X nodes only. In the attachment settings, make sure that Inherit arguments, Inherit exposed filters, and Inherit pager are set to yes. Set Render pager to no. Set Position to before and set Attach To to your page display.

2
  • awesome! thanks. this is the way!. I detected that if a expose a filter to select Content Types in Default display, the attached content type items will not change according the filter (may be is related with that are forced a content type in each display) so it's necessary expose the filter in the attached display (It can be infered of your answer).
    – cigotete
    Aug 9, 2011 at 20:51
  • I have a related question (restrict items listed in exposed filter (to list only 'default display' and 'attached display' filters in the exposed filter) drupal.stackexchange.com/questions/8926/…
    – cigotete
    Aug 9, 2011 at 21:22

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.