I am really pulling my hair out here :(
I'm attempting to create a View which I'd think is the work horse view of any web or graphic deisgner or any Portfolio based drupal site. A view which shows a block of related thumbnails which show additional images of the current portfolio item.
Background Info:
I've setup two custom content types using CCK.
1. Portfolio Item, contains a primary image and detail info
2. Secondary Image, contains image and node reference to Portfolio Item
Views Info:
I've attempted to setup a Views Block that displays the thumbnails of the Secondary Images that relate to the Portfolio Item.
The Problem
My views arguement code is either wrong or being ignored. My humble idea was to create an array of node id's which point back to the current node and return it to the View. I checked the sql in MySqlFront and it is returning the correct array of id's.
$linked_node = arg(1);
$result = db_query("SELECT n.nid FROM {content_type_item_secondary_image} n WHERE n.field_item_nid = '%d' ", $linked_node);
print "<hr/>" . print_r($result) . "</hr>";
//return $result;
Please Drupal Gods...where am i going wrong???
Comments
there are some strange
there are some strange things in your code:
<hr/>exists but</hr>makes no sense as far as i know... its a single tag like<img />then:
WHERE n.field_item_nid = '%d' ", $linked_node);should look like this:
WHERE n.field_item_nid = %d ", $linked_node);BUT when you want to display the secondary images (which have a node reference to your primary node) you should first add an argument in the view. something like:
"Node Reference: nameOfYourField (nameOfYourField_field)"
(there is a dropdown named Add Argument)
then all you need is the follwoing argument handling code:
args[0] = arg(1);its should work without any queries...
----------------------
okay.cool
You just made $100 US...
thanks for the reply.
I didnt realize i pasted in my code with some of my desperation debugging print statements included...
I meant to post
In any event, I made your changes and now i'm golden.
Send me your info and a link to your Amazon.com wishlist so I can show you some gratitude...
Are you interested in picking up some Drupal freelance work??