1

I've created a new content type "banner" (title,description, image, price) that I would like to display on certain pages (limited to parent pages). I'm using the Views module and was looking for a contextual filter or something like that but I'm a noob at Drupal and can't figure out my way.

For example, I have 2 content types: rooms and activities, 2 page listings respectively my rooms and my activities and finally I've created two banners, banner-rooms and banner-activities.

How can I create a Views block which displays the right instance according to the current page ? How can I limit it to the parent page (ie: do not display the banner on rooms/roomA, only on rooms)?

2

Suppose there are two views

views 1 url is - http://example.com/my-rooms

views 2 url is - http://example.com/my-activities

There are two blocks -

a) banner-rooms

b) banner-activities

On the block configuration page, You need to set the visibility setting of the block for specific pages.

=>Under Visibility setting, Select the tab "Pages"

=>Select the option - "only on the listed pages"

In the text-area, fill the urls e.g- banner-rooms

enter image description here

0

You should be able to get this to work using the Rules block visibility module, using a Rules Component that is pretty similar to what I described in my answer to "How to display a block if a user does NOT have a selected role?". All you'd have to do is to adapt the Rules condition to make it check if the path of the current page is "rooms".

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.