0

THE SETUP

I have a View set up to create a page out of a particular content type called "enticements". For context, an enticement is something that would make a guest want to stay at a hotel. Things like local attractions and dining.

So my view uses the content types [machine_name] in this order

  • Image [field_image]
  • Title [title]
  • External URL [field_link]
  • Body [body]

All fields are set to hidden because I want them to be arranged just so, all within the [body]. The body rewrite result looks like this:

<div class="enticement-wrap">
  <div class="enticement-image">
    [field_image] 
    <div class="enticement-link">[field_link]</div>
  </div>
  <div class="enticement-body">
    <h2 class="enticement-title">[title]</h2>
    [body]
  </div>
</div>

THE QUESTION This all works fine except that the [field_image] can be one or more images, but no matter what I try it only shows the first image. Even when I tried telling views to show the [field_image] with "Multiple Field Settings" set to "Display all values in the same row" in an unordered list, it still just shows the first image.

Why only the first image? Is there a way to get Views to use every image in the rewrite?
Or can I somehow nest a Slideshow View inside the Enticement view?

  • I discovered that the reason only the first image was showing is that my "Multiple Field Settings" had a "1" set for "Display ___ values". But I'm still curious to know if you can nest views. – Ben Dec 7 '11 at 20:45
  • Can you explain a little bit more what you're trying to do? There are ways to do at least some of what you're asking with say views relationships or manually embedding a view, but I'm struggling with what outcome you want. – Malks Dec 8 '11 at 1:39
  • The most fundamental thing I'm asking is how to insert a Slideshow View as a "field" in another View (or View Display). – Ben Dec 8 '11 at 13:36
7

Check out the Views Field View module. I have not used it, but it is supposed to embed a view in another one. Please post back if it works.

|improve this answer|||||
  • Is there a version of this that is more stable for Drupal 7? – Ben Dec 16 '11 at 14:01
2

I was trying to figure this out for an embarrassingly long time. I have a situation where I am trying to do a many to many relationship between two taxonomies (you could do this with content types too). I realize taxonomy can do this by default for just term names but I have image and other fields on my taxonomy terms that I wanted to use in a custom sub-view:

Page 1

Locations

  • Location A
    • Activity A (including title, image, descrip, etc...)
    • Activity C
  • Location B
    • Activity A
    • Activity B

Page2

Activities

  • Activity A
    • Location A
    • Location B
  • Activity B
    • Location B
    • Location Z

On the Location Page's view I used the views_field_view module to embed a secondary view of Activities inside the first view. The secondary view is set up as a block which has a relationship with a field-based reference to the Location's terms. (So each Location has many activities stored in a term reference field.) The block also has a contextual filter for Taxonomy Term ID that uses this relationship to point to the Location's tid. On the main view I have the Taxonomy Term ID field setup and excluded from display so we can use it as a token replacement. The views field is set up with the secondary view with a contextual filter for [!tid]. This way each Location row passes in its tid to the secondary Activity view which uses it in a reference to the Locations terms.

Hope this helps someone out!

|improve this answer|||||
0

I found a solution for making a nested unordered list of content (or content titles) with a view, basing the list results on hierarchical taxonomy. If that is helpful, you'll find it 3/4 down [this page][1].

  1. Set up your hierarchical vocabulary
  2. Add it to any selected content type
  3. Create a view listing nodes from that content type, displayed as an HTML list of the type "unordered list", with one of these contextual filters:

    • "Content: Has taxonomy term ID", if you want to list only nodes assigned to specific term

    • "Content: Has taxonomy term ID (with depth)", if you want to list nodes assigned to a specific term as well as to its child terms.

In this case, in filter configuration you need to set the depth, how many levels below (or above) you want this filter to work.

This will give you an unordered list of the entire hierarchy of node content (titles or whatever) in whatever sort order you have established. I have not yet discovered a way to display that listing as a hierarchical unordered list. It seems there must be a way; if I find it I will add it here.

|improve this answer|||||

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.