0

I have created one archive block using views for a content type. It holds the list of all the contents grouped year+month wise.

Now I want to display it on the left sidebar of all the pages having this content type.

Using Block configuration of this archive block I have displayed it on certain pages, but I can't set it to appear on all the pages of type node/*, because all nodes do not contain that very content type.

Please help if anyone knows the solution to it .

4
  • Do you insist it needs to be a block? Or something that may look like one would be OK too?
    – Mołot
    Commented Aug 28, 2013 at 7:32
  • PS Could we remove version from title? You can do it pretty much the same way in all major versions.
    – Mołot
    Commented Aug 28, 2013 at 7:45
  • @Mołot: No, it's not necessary.
    – Nikhil
    Commented Aug 28, 2013 at 7:50
  • I gave you an answer for directly what you asked, but I think using Viewfield module might be cleaner solution in your case.
    – Mołot
    Commented Aug 28, 2013 at 7:55

1 Answer 1

1

If you are using Drupal 7, you can go to Home » Administration » Structure » Blocks, and hit configure next to block you need: enter image description here

In the Visibility settings section use Content types tab. In Drupal 8 it looked similar and probably will not change significantly. enter image description here

The same functionality was backported to 5 and 6 by Block Node Visibility module.

If you don't want to install above module, and you're using Drupal 6, use Pages tab, and select last radio button "Pages on which this PHP code returns TRUE", and use code like:

<?php
// valid node id in view mode
if ( arg(0) == 'node' AND is_numeric(arg(1)) AND arg(2) == FALSE ) {

    $node = node_load(arg(1)); // cached

    if ( $node->type == 'insert type you want' ) {
        return TRUE;
    }
}

return FALSE;
?>

Code sample by bluesherpa from Drupal.org.

0

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.