1

I have two content types. 1. Lecture 2. Notes

Notes have an entity reference field which references lecture. Different users create different notes each referencing to a lecture.

Now, How do I display note created by user on lectures page.

1

I know how to do it with Views and Panels modules. First you need to create two Views:

  1. First one is Lecture_view create a block and add fields you want to display(Title, body, most important - Content: Nid and any other fields your Content type has).
  2. Second one is Notes view, create same block but fields for notes to display, and also in a Contextual filters menu add new filter (Content) Content: Nid

Now you should go to Lecture view and in Advanced menu, click on theme information link, and you need to create template file, find row with Field Content: Nid and create one of suggested fields, something like (views-view-field--conversations--page--nid-1.tpl.php) in /sites/all/themes/YOURTHEMENAME/views/YOURVIEWNAME(lecture_view--block)/YOURTEMPLATEFILE(views-view-field--conversations--page--nid-1.tpl.php) in this file you will past code from theme view, its something similar to

<?php print render($output); ?>

you need to add one more thing embed that views:

<?php print views_embed_view('notes', $display_id='default', $row->nid); ?>

your contextual filter should work, and now you can add this view to your Panel to display, in Panel menu.

Maybe this is not the best way to do this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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