Link a field in views to swap content on a page

hairybrew - July 19, 2009 - 01:04

Is there a module in Drupal 6 to link a field to a node, but instead of loading a new page it loads a node item into a container div on that same page. I saw there is AJAXify and it sounds like what I want to do except there is no Drupal 6 version of it.

Or maybe there is another solution and I'm not seeing? I wanted to use a carousel built using views to link thumbnails to their main image or video and load that image within the page (as opposed to something like thickbox that uses a popup effect).

2 Possible Approaches: Module and Code

Chris Einkauf - July 19, 2009 - 02:21

Two possible approaches, off the top of my head, are:

1)

jQuery. (I'm not sure about the exact code you'd need to use, but I'm guessing there are some relatively easy ways to accomplish this task using jQuery. jQuery functionality is already built into Drupal, but you can also download additional jQuery plugins here, which might provide you with the solution you need. Check out the jQuery documentation for more info.)

2)

Node Reference Formatters module (you'll also need to enable the Node Reference module). For this approach, if you want content type A to include a field that opens a content type B node within content type A, you'd add a node reference field to content type A which references content type B. Then, with the Node Reference Formatters module, you can "format" that node reference field in 1 of 4 ways:
-Fieldset: Standard Drupal collapsible fieldset, which contains the node of content type B.
-AHAH link: Button with #ahah property and value of referenced node title. When user clicks on it referenced node is called dynamically via AHAH callback which is in Drupal core.
-jQuery clueTip (you'd have to download the clueTip jQuery plugin): Nice dynamic (ajax) content loading in a tooltip when user hovers mouse on the link.
-Thickbox (you'd have to download the Thickbox jQuery plugin): Loads referred content into thickbox.

I should also point out that with Node Reference Formatters, you can display the node of content type B in 3 different ways:
-teaser
-full node
-custom (this offers the most flexibility in terms of which content type B fields are included, as well as how they are styled).

Thanks for the input. I

hairybrew - July 20, 2009 - 23:43

Thanks for the input. I really appreciate you taking the time to respond.

I figured I'd be able to do a views attachment, and do something like the ajax pager but use a thumbnail view instead. But after playing with it for a while I suppose not.

The ahah link sounds like what I want, but my plan wasn't to use node reference cck field since that type of content relationship wasn't necessary, but I'll look into that one. The jquery part I could handle if it was just a static page, but it's integrating it in Drupal modules that gets to be black art. I could hard-code js based on the content type and just worry about the jquery aspect to get the job done, but that wouldn't be very flexible. I'm taking a look at a module development book and some articles to try and get through the learning curve.

Hey all thanks for the great

UNarmed - October 14, 2009 - 10:20

Hey all thanks for the great info!

Hairybrew i am looking for the exact same thing, what did you find to be the best solution?

Muchoz thanks

 
 

Drupal is a registered trademark of Dries Buytaert.