By apramakr on
Hello,
I am trying to display the title of another node on my Product page. I would like for the title to be a link that takes me to that particular node.
I added a content type field with node reference, which populated all the titles of the nodes.
Now ehen I use, print $node->field_also_try[0]['view'] , the entire node content gets displayed. But I only want the title of that particular node to be displayed. How do I go about doing this?
All help appreciated!!
Thanks much!
Comments
any help at all..
any help at all is much appreciated!! I am kinda stuck right here unable to move further...
thanks in advance!
Edit/configure the content
Edit/configure the content type. Visit the "Display fields" tab, for your node reference field set the format to "Title (link)".
assuming 'field_also_try' is
assuming 'field_also_try' is the name of your node reference field,
$node->field_also_try[0]['nid']will give you the node ID of the referenced node.you can then go on to do whatever you'd like with the node ID, like node_load to get the entire node object (expensive, performance-wise), or a db query to just get the specific fields you need.
hth!