Hi,

I want to use a block which have the latest weblinks of the same category in which the node-page is.
And a block of the latest chosen weblinks of the same specific category.
I have the category and views modules installed and they work ok.

The node itseld will be shown at that moment, and hopefully also the blocks as described above.
Can somebody help me how to fix this?

I see a lot of snippets which refer to the $taxo_id, but with the category module installed I can't get this working.

Thanks in advance,
Greetings,
Martijn Haan
www.ontwikkelingswerk.net

Comments

summit’s picture

Hi,
I fianlly found a snippet for this. (http://drupal.org/node/2498).
With this snippet I can show the other nodes of a specific category.
The snippit I used is:

<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
  $nid = (int)arg(1);
  $terms = taxonomy_node_get_terms($nid);
  $output = "<ul>";
  foreach($terms as $term){
    $sql = "SELECT n.title, n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid = $term->tid AND n.nid != $nid LIMIT 5";   
    $result = db_query(db_rewrite_sql($sql));
    if (db_num_rows($result)) {
      $output .="<li>$term->name</li><ul>";
      while ($anode = db_fetch_object($result)) {
        $output .= "<li>".l($anode->title, "node/$anode->nid")."</li>";
      }   
      $output.="</ul>";
    }
  }
  $output .= "</ul>";
  return $output;
}
?>

Drupal is great!!
www.gratis-informatie.nl