0

I'm using Drupal 7 and Views. I have 4 different content types and I want to be able to display each content type in separate view. What i did is I create a view and a page and i set the view Path to node/%

After that I'm using contextual filters to get specific node. It's working when I'm on view creator page and the preview.

I have 4 such views, each for particular content type.

When I save the view and I'm trying to load a page it takes wrong view and it gives no results found.

How to solve that issue and have multiple node/% pages? Is there something like views order or priority in loading? Shouldn't it have any filtration and pick the correct view based on content type?

Any tips will be appreciated:)

0

It won't work, if you give same path for different views/displays then it will load the view/display with the least id.

But why you want to give same path for all views?

  • OK, i thought so;/ The deal is that I have all links like that: http://domain.com/article1 http://domain.com/video2 and so on. So there's nothing specific in URL. First one is pointing to Article content type, second one to Video content type. Now i want to display separate pages for this two things using views. There will be completely different stuff on each pages. So i need to views. But how to load correct view based on content type? – Astaz3l Jun 27 '14 at 8:53
  • then can't you assign the path like article/* for article and videos/* for videos. – wolverine Jun 27 '14 at 8:58
  • That would be awesome and easy idea but client want to have as friendly path as possible;/ Is there any other solution or module that You know about that could help me a little bit with this issue?:D – Astaz3l Jun 27 '14 at 9:00
  • what are you passing as contexual filter, nid/title ? – wolverine Jun 27 '14 at 9:01
  • I'm passing nid only – Astaz3l Jun 27 '14 at 9:02
0

You can use the Panels Module Once the module is installed you can override the Node View Page on admin/structure/pages/edit/node_view

You can create one variant for each of the content types and within that you can add the view that you are using.

0

I agree with @Gokul N K's answer. However if you are using blocks for the content on the pages and you need to change which blocks appear based on what type of content you are viewing, you can go into each block and under Visibility Settings > Content Types select the content types that you want that particular block to show on. Or better yet look into using the Context Module

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.