0

I am building a national site, with 30 locations. Each locations page is built from a single content type, "venue".

For each location, the manager is given their own login details so they can keep their venue page up to date.

They will also be able to create an Article whenever they have news. All Articles will display a teaser on the main national page, but It should also appear on that managers location page, but not all of the others.

I am after some advice on how to make this happen with views. Obviously I wouldn't want to create a separate view for every location page and only display results by author.

Ideally there would be one view that I could display in a block on every venue page. It would need to get the related author information (maybe from a CCK field), and then display the article results of the owner of that venue. But how do I connect a node to a user, that a view can read?

Hope that makes sense, I'll try and explain it better if you need me to!

3

This is rather straightforward in Views 3.x - you just want to create a relationship based on the field that you are using to associate the content. This could be something as simple as an author but for your case it sounds like you are going to have multiple types of content that relates back to a venue, ex. articles, etc.

So you would want to use a module like entity_reference and create a field of type entity reference, perhaps named "Related to Venue", that connects to your venue content type. Then add this field to whatever content types you have and when a user adds a new node (ex. an article) they could relate that back to the appropriate venue.

Now in your view block for the venue page, you just need to create a relationship using this field and then add a contextual filter that will find the appropriate node id from the venue page. This is a bit tricky but this is a very common task and this handbook page on d.o walks you through the basics.

  • Perfect answer. Exactly what I was looking for. Thank you very much! – Collins Dec 1 '13 at 23:21

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.