1

I am new to Drupal 7.

I have two content types, they are 'school' and 'course'. In course content type, I used Reference module to create a field that reference to school (a school have many courses, and a course is belong to one school only).

And now what I want is, when I view a specific school info, the list of courses that belong to the school also be displayed beneath.

How can I do that in drupal 7 ? :D Thank you in advance!

1
  • With Entity Reference you could simply use Views. Can't you do it with Reference?
    – Mołot
    Commented Jun 17, 2015 at 11:41

1 Answer 1

1

You need to create a view of contents filter by Course content type. Now I assume you have a field name field_school.

Add this field in Contextual Filter and select default argument Content ID from URL.

When this block will be added on node page, it will automatically filters the courses of that school. Otherwise pass the school id as argument to view. :)

Here is the screenshot :

enter image description here

4
  • Hi @Sumit madan, Thanks you! I'm now can get a list of course by passing the school id as argument to view (in my case, it is: localhost/mtclanguage/?q=couse-list-of-school/1). I don't know how to add the block to school node page?? Can you explain further how to do that?? :D
    – user48552
    Commented Jun 16, 2015 at 6:28
  • Yes, Just add a view display "block", in your block list you can see the block. You can assign that block any region. If you are using panel, then it will be available in panels too. For more detail you can google it. :) Commented Jun 16, 2015 at 6:39
  • Love to hear that. :) Commented Jun 16, 2015 at 10:57
  • @user48552 as soon as you're able, be sure to 'accept' this answer by clicking on the check mark to the left of the answer body
    – Geoff
    Commented Jun 16, 2015 at 23:01

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.