Using a CCK text field to relate pages to images for a Nivo slide show

Events happening in the community are now at Drupal community events on www.drupal.org.
Screenack's picture

Using Drupal 6.19, Views 2.11, Views Nivo Slider 6.x-2.0

The Nivo slide show works wonderfully; now I wish to associate specific slides to pages.

Qualifiers:
I have a CCK text field, "show on page" ('show_on_page')
I have a nodetype "Slideshow image"
A page node can only have one "show on page" field selection
A SlideShow Image, however, many have multiple "show on page" field selections

I can successfully manually pass any of the "show on page" text strings via the views argument preview. However, how do I (get and then) pass a current page's "show on page" CCK field as an argument to the view on that page. I can specify the "content > Show On page" when adding arguments to the view, but, its not passing a value. I'm using "Basic Validation" for the argument.

Much thanks!

Comments

The way you have that

caschbre's picture

The way you have that currently setup, you'd have to use some PHP in the argument to pull the value from the current node.

I'm not familiar with nivo so I'm trying to understand your setup. What value are you putting in the page->show_on_page cck field? And then what values are you putting in the slideshow image->show_on_page field? Are you simply using both of those to sync a slideshow image to a page?

If that is the case, you may want to use node reference. You could create a node reference field (let's call it page_noderef) on the slideshow image content type. You can allow for multiple values and select the page content type as the only allowed node types. Then when you create a slideshow image you select the pages (by drop-down or auto-complete) that you want them to show up on.

Then in your view you add page_noderef as an argument and select to pull the NID from the URL.

Node reference

Screenack's picture

Interesting suggestion. For this discussion, the nivo implementation is irrelevant. To simplify the discussion, I want to have a view that returns all images that have some association with a page (one page to many images, and images may have multiple page suggestions) Yes, using Node Reference might do the trick (if I presume correctly) I'll give it a shot -- thanks!

I'd highly recommend node

caschbre's picture

I'd highly recommend node reference then. It is built to tie nodes together and works great within views as arguments. Let me know if you need help with it.

So close

Screenack's picture

So close, but not yet.

On the content side:
I've added node reference CCK types to the slideshow image nodes, named "Page Node Reference"
I've pointed the SI nodes to the appropriate page nodes via Page Node Reference

On the views side:
I've added an argument via the Page Node Reference CCK:

Title: ""
Breadcrumb: ""
Wildcard: all | Wildcard title; all
Action to take if argument is not present: Display all Values
Validator options:
Validator type: node; types (none selected)
Validate user has access to the node: false
Argument type: "Node ID"
Action to take if argument does not validate: "Hide…"
Allow multiple terms…: false
Exclude the argument: false

In the Views Preview argument field, if I enter the Node ID, the preview displays the correctly linked SI nodes. But if I use an URL to test the use in the context of a block embedded on a page, the views preview fails

Views arguments don't work

sheena_d's picture

Views arguments don't work for blocks, you have to process the argument manually.

Issue: http://drupal.org/node/150482

Tutorial: http://drupalsn.com/learn-drupal/drupal-questions/question-2650

Blocks don't quite pull

caschbre's picture

Blocks don't quite pull arguments the same as a page view, but it's easy to work around.

Simply edit the argument and make the following changes...

Action to take if argument is not present: Provide default argument --> Node ID from URL

That did the trick

Screenack's picture

Craig, much much thanks! That did the trick. I can not preview in the views screen via the arguments field, but it works nicely on the appropriate pages.

Sheena: much thanks, too! I so appreciate your help.

North Carolina

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: