0

I have 2 node types: Authors and books. Authors has node reference to book node type. Created view:

enter image description here

Relationships - i have used reference field, in arguments i have used Node: nid (content id from node URL).

In fields i have used my noderef relationship.

in a node.tpl.php:

print views_embed_view('video', 'block_4', $node->nid);

But it shows nothing. (i have created 1 node author, and 2 nodes book)

Views 2, Drupal 6. What i am doing wrong? Thanks

1 Answer 1

0

The function views_embed_view is meant to be used to embed the view in a page or a block during the processing of a page. After the page processing is done, the results are passed to the theme engine. It is not meant to be used in the theming stage.

What you can do is create a region in your template where you want the view to appear, then create your view as a block and place it in that region on the Blocks admin page, following the insructions here;

2
  • Thanks but the problem is not in the views_embed_view(); i already have tried to put in a drupal region. I am asking a help with correctly setting up the node reference in a view. Commented May 30, 2013 at 19:01
  • 1
    Actually, you said "But it shows nothing." Other than that, you have not described your view or its use. I just duplicated the view you described, with one Author and two Book pages, and linked the author type to the book types. I used a display type of Block, and placed the block in the sidebar of the Author type. View works fine when I view the Author page! There is nothing wrong with the view logic you have given. It is correct as far as you have explained it. (The image you have given is of no help to those of us not familiar with the Cyrillic alphabet).
    – Triskelion
    Commented May 30, 2013 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.