12

I'm trying to decide which should I use. Both can inherit contextual filters, so in my case both of them are good solutions. Except that I already have the other view that I want to put together with the first, so with Attachment I would have to redo the whole other view as a new display of the first, but with View area I could just reuse the other view.

What is the concept behind them? Are there other differences than what I noted above?

8

Background: View is a view, a view can have many displays, such as page, feed, attachment, block.

With Attachment display, you can attached one display of a view to another display. A good video demo can be found by Doug Vann (its a drupal 6 demo, that can relate to drupal 7).

With Global: View area (Drupal 7 only) you can add a view inside a view header or footer.

This is no huge pro/con of doing it one way over another. The only thing I can think of is templating a view and styling it. There will be different html tags and classes for you to style.

1
  • With both methods inherit contextual filters?
    – chrisjlee
    Mar 29 '13 at 20:16
1

As iStryker says, attachments allow you to attach one display of a view to another display of the same view.

Using Global: View area allows you to attach a display of another view altogether. This can be useful if the two views are not compatible.

For example, if you want a view of taxonomy terms attached to a view of nodes.

2
  • By this reasoning, does using Global: View area supersede using Attachments? Why does Drupal always seem to provide you with 10 different ways to do exactly the same thing?
    – dayuloli
    Mar 4 '15 at 8:50
  • 1
    In this case, they're not exactly the same thing. If I want a view of nodes of a particular type, with promoted nodes at the top, formatted slightly differently to non-promoted nodes, I would use a view attachment. It makes sense because they are two instances of the same view, with minor differences. As an attachment, they're kept together in the views UI, and will have similar template suggestions and classes. If I want to have two different views connected and using the same contextual filters, I'd use Global: View area
    – malcomio
    Mar 6 '15 at 7:26
0

I don't know if I'm confused but;

I can use pagination of the host view without any problems if I attach another view in it (header or footer) but the pagination isn't available if I embed another view's block or page into header (or footer) so it's a big difference to me...

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.