Hopefully a quick question here. I've been playing around with Views Attachments this morning and I like it a lot. It's very powerful once you get the hang of it. You can override it sufficiently such that the two views are independent of one another, e.g. viewing completely different node types and fields.

My problem is that I'd like to create a single view with two different view *types*, the first view using Terms (taxonomy), the second using nodes. Both need to use the same argument (taxonomy id) passed to the page.

Is this possible? If not, is there a recommend way of doing this? Perhaps a page with two view blocks? A view with an embedded block (also a view?)

Thanks in advance for your time.
Trevor

Comments

trevorbradley’s picture

Hmm, if Attachments won't work for me, perhaps this is the solution... Embed one view in another view's header:

http://drupal.org/node/42599

EDIT: Argh, last one was for Drupal 5. This should be more recent.

http://drupal.org/node/246742

merlinofchaos’s picture

Status: Active » Fixed

The two canonical solutions are to use view embedding or Panels.

trevorbradley’s picture

Status: Fixed » Active

Thanks merlinofchaos. It's good to know that this isn't possible in Attachments, but that there are alternatives out there.

I think I may go the embedding route. There's a lot of Views 1 stuff out there to be confused by, but I've managed to cobble together the PHP code I'm looking for.

Embedded in the header of View #1:

  $view1 = views_get_current_view();
  $args = $view1->args;
  $view2 = views_get_view('VIEWNUMBER2');
  print $view2->execute_display('default', $args);

I may investigate Panels as an alternate solution, but at the moment this is working for me.

merlinofchaos’s picture

Status: Active » Fixed

Marking fixed again since you've got what you want working.

trevorbradley’s picture

(Whoops, sorry about that! I'll learn someday...)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.