1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Make a block view appear for a content type only

Discussion in 'Drupal' started by historiasdemaria, Mar 7, 2011.

  1. #1
    Hi everybody,
    I'm working on my site made in Drupal 6, I've created a view to show links for a content type nodes.
    I would like for this view to appear only for this specific content type.
    I've tried to insert some php code that I've copied paste from Drupal site, but it doesn't work.

    Do yo know how to do this?

    Thank you!:)
     
    historiasdemaria, Mar 7, 2011 IP
  2. historiasdemaria

    historiasdemaria Member

    Messages:
    138
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #2
    Well I'm answering myself, I found this one here http://drupal.org/node/844110 and it works:

    $nodeType = "news";

    // 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 == $nodeType) ) {
    return true;
    }
    }

    return FALSE;


    I'm posting it in case you need it too! ;)
     
    historiasdemaria, Mar 7, 2011 IP
  3. ashishy.freelancer

    ashishy.freelancer Peon

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    its really easy just add filter ..in filter select node type and which content or cck you want to show click on that..
     
    ashishy.freelancer, Mar 8, 2011 IP
  4. historiasdemaria

    historiasdemaria Member

    Messages:
    138
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #4
    Yes, the filter is in the view, but I can'f find it for the block, to make it a block condition, see?
     
    historiasdemaria, Mar 10, 2011 IP