hi
i hope i am writing in the correct form.
I have been struggling my head for the couple of days with this issue and been searching the whole drupal community without any results, so i hope someone out there can help me with this.
i am working on book publishing site where i first of all have a node-product.tpl.php site where i control all my displays.
i have a content type called product where i have created all my field with CCK and i have no problem displaying them.
In addition i have created a content type called author info where i have information about the author, biography, photo etc.
do to many titles from same author, I want to insert fields from my author content type into my node-product.tpl.php so i dont need to type in information about the author every time into a field within product.
this is much more difficult than i first thought.
in my content type product i have a reference field which is field_author and it is referenced to the author node.
in my node-product.tpl.php my author field is printed:
print $node->field_author[0]['view']; without any problems.
what i want is to call up the authors info in the node.tpl.php, meaning that when i fx my field_author prints Dan Brown, i want Dan Browns info from the content type to show up below.
i hope i made myself clear on this.
i have tried to do a couple of things, i tried to hook it op in views where a created a view and used the
$view=views_get_view('authoronproduct');
$myargs = array(arg (1));
print $view->execute_display('page_1', $args
snippet, and set my arguments to nid and relationship to the author node reference field but without any succes. (i get all authors displayed and not those linked to the node reference)
i have come to the point that i probably need to create some kind of statement saying:
"php if field 'field_author' is displayed then print the body and field_photo from the content type author (or the node-author.tpl.php)
is this the right way of doing it, or am i way of track?
any help is highly appreciated..
thanks in advance
Comments
Comment #1
egill80 commentedOk, i kind of moved the problem statement to a step further.
Now i know that if a create a preprocess function:
then i can create a function that can be placed in every node-(type).tpl.php,
this means that i have to create a function that says as mentioned above that hook the author name - print field_author with the content type author info, then a can just call this function 'author info' and then just print $node->content('author info') in product.tpl.php
but the question wish is still unanswered is how do a create this function, field_author hooked with content type author.
so when author field is dan brown, the product.tpl.php prints the content type node dan brown??
Comment #2
egill80 commentedi managed to solve the problem and i want to post it if anybody has similar issues to solve
the code was actually much easier than i thought.
as stated earlier i used to node_load function to get the nid.
http://api.ubercart.org/api/function/node_load
just created a variable and then i printed it below.
(i think the reason why it is so easy to hook it is because its a node reference field to the node but i am not sure about that though)
the code;
by this you can gain control over your node as desired.
not sure if its the right way but it worked for me
Comment #3
avpadernoI am closing this issue, since it is for a Drupal version that now is not supported.
Please re-open it if the issue is also relevant for other project branches that require a supported Drupal version