Displaying similar nodes

后端 未结 3 677
花落未央
花落未央 2021-01-29 04:25

I\'ve somewhat ran in to a problem with Drupal today.

I would like to display a node (Product) on a page, and below that node, I\'d like to display 3 similar nodes (Pro

3条回答
  •  猫巷女王i
    2021-01-29 04:49

    You can have multiple terms when you change to

    $node = node_load(arg(1));
    if ($node) {
        $ret = array();
        foreach ($node->taxonomy as $term) {
            $ret[] =  $term->tid;
        }   
        return implode('+', $ret);
    }
    return '';
    

    The '+' in implode is OR. If you want AND, than use ',' instead

提交回复
热议问题