2

I have searched through all the questions, but I can't seem to find the information, I need. Accept my apology, if this has already been covered.

On a site for a law firm, I have a content type, called "People" (not the same as User) with multiple fields containing information about each individual. I want to display part of a node in a page view, and other parts (such as image, contact details etc) in a block view. The page and the block view has to be related, obviously. I can only find answers on how to relate nodes/files with each other. Not just from a single node.

I cannot get my head around how to filter it, and how to use the contextual filter function. I understand as much, that the context must be with the NID. I just need a 1,2,3 ...

Drupal version 7.22, Views 3

I'll appreciate any help, thanks

  • Christian

EDIT: OK, it's solved. And in the end, it wasn't as complicated. Thanks to Rémy, to steer me in the right direction just using normal node (no need for a Page view here)

Here's what I found:

1) No need to fiddle with PHP templates here. Under Content type, just decide which fields, you want to see on your page. Make the others hidden.

2) In Views, create a block view (in this case), under Advanced - Contextual filters, select Content: NID, select Provide default value - Content ID from URL.

The main source of confusion for me was I 'wanted' it to rely on alias in the path. It doesn't. Views isn't checking for that at all, but only for actual node ID - e.g. 108, 109 ...

  • glad you made it ;) if you arrange all in your template.php it's more performant ;) – rémy Apr 22 '13 at 17:36
0

for the page view use the normal node, and hide the stuff you want to display in one of the block in your node.tpl.php.

then create a new view showing your contenttype, with the actual node id as contextual filter. make block displays, put the fields you need for your different blocks in each block. add the block in to the page, only showing it for the actual contenttype.

  • Thank you for this. It's not clear to me how this works. Is it necessary to edit in the php templates? I'd rather just set it all in Content type, and Views. Preferably hiding the original node, and use a Page View and Block View combined, showing one item at a time, with no pager. Creating those views aren't difficult. What I have an issue with is how to work with the path and contextual filter. So, what path do I set in Page View (with a wildcard), and what do I set for contextual filter in the Block View? – Christian W Apr 22 '13 at 11:02

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.