Here are the steps I have done to create the functionality I'm hoping to achieve:
- create a new content type called 'clients' - this will hold client the client name and an associated image
- create a new content type called 'project' - this will have data for a new project. In this content type I created a field called "field_client" which makes a select list from the node reference of 'clients'.
This works great as when I go to create a new 'project' it gives me a select list of the different 'client' nodes.
- I set up a view to filter just the 'project' types. When I test the views service, the projects are displayed as follows:
Array
(
[0] => stdClass Object
(
[field_client] => Array
(
[0] => Array
(
[nid] => 10
)
)
)
The views.get is working great as well. The issue herein lies that I want field_client to return not the node id, but the actual fields inside of that node (title, image). Ideally I am looking for something this (forgive my lack of php syntax):
Array
(
[0] => stdClass Object
(
[field_client] => Array
(
[0] => Array
(
[nid] => 10
[title] => client name
[image] => reference to image field
)
)
)
This way I have a string that I can pull the client name from directly.
Any thoughts/suggestions?
Thanks!
Comments
Comment #1
merlinofchaos commentedUnder relationships, add a relationship using your nodereference. Once that relationship is in place, when you add the node title field (for example) you can select which node to display. That should get what you want.
Comment #2
vanillabass commentedThanks for the response - when you say 'add the node title field' where would I be adding that? I was able to access the data using the 'fields' row style, however I am trying to get it to work with the 'node' row style.
Ex:
[6] => stdClass Object
(
[nid] => 15
[node_node_data_field_client_title] => Attack
[node_node_data_field_client_nid] => 12
)
I am bringing this info into Flash - and accessing the value isn't very straight-forward. I am looking to have the data come in like so:
[6] => stdClass Object
(
[nid] => 15
[client_title] => Attack
[client_nid] => 12
)
Thanks!