Im having trouble rendering fields that use references, the variable from 'available variables' always returns a number rather than the fields content. For example i have a two content types:
content type: section
fields: section name, description
content type: article
fields: article name, body, section (node reference)
So i have a view that shows me a list of articles and shows me the 'article name', 'body' and 'description' (referenced from 'section') and when i use the provided variables for 'article name' and 'description' everything works fine, but when i try to access the variable for the referenced field 'description' it just returns a number.
Any idea whats happening here?
thanks
j
Comments
Comment #1
hcmogensen commentedI have the same problem
It looks like the it is returning the nid of the node rather than the nid of the node that is being referenced.
Anybody have a fix for this?
Comment #2
jaymcgraw commentedsame issue
Comment #3
dean.humphreys commented+1
Comment #4
westbywest commentedsubscribing. same problem with 7.x-1.x-dev.
Comment #5
lgammo commentedThis is a serious problem indeed, and needs attention.
Comment #6
lgammo commentedAfter some debugging ...
The original poster has a field called description which seems similar to the field I have. The field I have is a text field and it is implemented as a node (in its own table).
I managed a work around for accessing my field data by rummaging around the contents of the $data variable available in the output section.
I used print_r ($data) to discover the structure until I found out how to get to the value I wanted.
THIS IS AN UGLY HACK. Please no flames.
Ideally, there should be a simple variable access, but that variable now gives you a node reference.
Enjoy...
Comment #7
DerekL commentedYes, a nasty one this.
Comment #8
seanmadsen commented+1
Comment #9
johnvUsing $data variable is a good workaround.
This is a duplicate of #1140896: Variable $row does not contain correct values ($data->_field_data does)
Comment #10
lgammo commentedThis might help avoid my prior hack by using the drupal node and field API.
I had code like this in the output area of a field:
This type of code may help with these field mentioned above. Please try and share with the group.
Comment #11
szy commentedThat's still present bug :/
Szy.