I am trying to get some additional information into a Views list by executing an sql query. The problem is that I need the uid of the views node, but this information doesn't seem to be held in the $node of the view.
However, as $node->nid is valid for each node returned by the view, I can use this to get the uid. My problem is that I can't get the sql that would allow me to get the title of another node by the same uid. I suppose I could do it with two seperate sql queries (one to get the uid from the first node and the other to get the title of the second node based on the uid).
Can someone give me a clue on whether/how I might do this via a single query?
with $node->nid I can get the uid, using that uid I can then get a title from another node.
Hope someone with some better SQL knowledge can help.
Thanks
Comments
Please explain
1. 'Views list' - is it a list of views or a list of nodes generated by some view
2. What is a 'views node'
3. How are you going to determine 'another node' if you get them by uid? There may be a lot of nodes with the same uid (even entire site)
/Michael
explanation (sorry I wasn't clear)
1. When I say 'views list' I mean list of nodes generated by a view.
2. A 'views node' is one of the nodes listed by the view.
3. I will get the other node by uid & type. Since this is a nodeprofile, there will only be one per uid.
Essentially, my View will return a list of 'publications'. When displaying this list, I'd like to include the full name of the author which is the 'title' of their nodeprofile.
thanks,
G
Sorry for not answering long time
if you use phptemplate to theme your view, you can call user_load function:
$tempuser=user_load(array('uid'=>$node->uid));and then insert$tempuserobject fields where you need/Michael
if you use phptemplate to
if you use phptemplate to theme your view, put that in you view-name_of_view.tpl.php :