how to add field from one tpl.php to another tpl.php?

Created on 10 March 2010, over 14 years ago
Updated 2 April 2023, about 1 year ago

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

💬 Support request
Status

Closed: outdated

Version

1.0

Component

Documentation

Created by

🇩🇰Denmark egill80

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    I 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

Production build 0.69.0 2024