开发者

Unable to use multiple images in a single node to create a a slideshow in Views

First take a look at my node setup here: http://imgur.com/a/DJdRw

The first image is my Subpage slider content type which accepts multiple images and will essentially be my slideshow.

Second image is the default page, but I added a node reference to the Subpage slider node. It allows you to associate a particular slideshow to a page.

开发者_JAVA技巧

The last image I was messing around with Views and Views Slideshow, but I don't know what I'm doing. I managed to get images displayed, but as you can see it displays the images of a long vertically. I set the Views slideshow and it creates a slide between multiple nodes and not the multiple images in ONE node.

Where do I go from here?

Thanks


To display a block with a slideshow of images (from a referenced node) when viewing a page

I have come up with a much easier ("duh" moment) way of doing this. I created the functionality on a fresh Drupal install. Assuming you have the following modules: CCK (w/ Node Reference enabled), Views, Views Slideshow, FileField, ImageField.

  1. Create your content types (in this case: slider and using the core page type)
  2. Add an imagefield to the slider content type (field should be named field_images)
  3. Add a node reference field to the core page content type (field should be named field_slide_ref)
  4. Edit the node reference field settings (can remove "Required" if you like)

    Unable to use multiple images in a single node to create a a slideshow in Views

  5. Create a new view called slideshow
  6. In the slideshow view:
    • Change Basic Settings->Style to "Slideshow"
    • Add the field "Content: images" (choose Format: Image at bottom, unless using ImageCache)
    • Add an argument of "Node: Nid" with the settings:

      Unable to use multiple images in a single node to create a a slideshow in Views

    • Add a "block" display
  7. Enable your new block labeled "slideshow: Block" at example.com/admin/build/block

If configured correctly, when viewing a page with the _slide_ref_ field referencing a slider node, you should see the slideshow displayed in the block.


Old Solution...

To display a referenced slideshow inside the page node being viewed:

  1. Download, install and enable the View Reference module
  2. Create your content type with multiple images (Subpage slider) [Done]
  3. Create a new "page" view in Views UI. Add the field Content: YOUR_IMAGEFIELD (from Subpage slider) important: don't group the images, under Basic Settings->Style choose "Slideshow" and add an Argument of Node: nid choosing Provide default argument->Node ID from URL as argument settings
  4. Create a view reference field on your page content type where you want to see the slideshow and select the view(s) that can be referenced and in the "Arguments" fieldset check: Allow delimiter seperated values and click "Save field settings"

Now when you create a default page there will be a view reference field to select the view you want to use and an argument field where you can input the node id of the node with your images you want to show as a slideshow in your page.


THE QUICK SOLUTION: a really simple tweak which the Views Slideshow docs should put in lurid bold gothic writing:

If you want to slideshow multiple images from an image field of one node ** don't forget to untick the "Group multiple values" checkbox in the settings for your-view>Fields>your-image-field **


This outlines how to make a slideshow of images that are taken from one node. The main point here is that you have to make a block that has an argument of node id taken from the url. I used this to make a slideshow showing as a block in the main content area, but you can of course put the block anywhere.

Modules:

CCK
imagefield
views
views_slideshow OR jCarosel

  1. Create your Content Type with an image field, allowing multiple values.

    1. Create content with multiple images, distinct enough so that you can tell if the images are from one particular node or another node
  2. Create a new view as a node.

    1. Create a Block display
    2. Give your block a name (under Block Settings, left column)
    3. Filter as: published, as your Content Type and with the image field (important - see last step why).
    4. Field: your image field.

      1. Make sure to uncheck the 'Group multiple values' checkbox
      2. Display as an image, or an imagecache preset. Whatever you like
    5. Add an argument:

      1. Node: NID
      2. For 'Action to take if argument is not present', select 'Provide Default Argument'

      3. Node ID from URL

    6. Under 'Basic Settings' select

      1. If using views_slideshow, select the Style to be: Slideshow (Single-frame).
      2. Items to display: unlimited
    7. Save your View
  3. Go to your Blocks page (/admin/build/block) and place your newly created block into the main content area (or wherever you want it to be). If you need to set the visibility on the actual block itself (/admin/build/block) then go ahead but otherwise only nodes of the content type that has multiple images will show the slideshow of images, while other pages on your site will not. This is why it is important to set a specific filter and to use the argument. Done!

Essentially, this does not work as a page but has to be a block. The slideshow will use the NID to see what images are in that node and create a slideshow of those only.

Should work the same in Drupal 7 but have not tested this.


The solution is to add as argument not the 'node id' but the 'slideref field' and provide default argument 'nid by url' and the slideshow by node will work.

You can use the Views Nivo Slider as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜