i want to show similar node links under nodes, above comments in node pages...
similar.module lists the links in a block... and uses the codes below:
/**
* Implementation of hook_menu().
*/
function similar_menu() {
global $similar_node_title;
global $similar_node_body;
global $similar_node_nid;
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(array('nid' => arg(1)));
if ($node->nid) {
$similar_node_title = $node-> title;
$similar_node_body = $node-> body;
$similar_node_nid = $node-> nid;
}
}
}
/**
* Implementation of hook_block().
*
* This hook both declares to Drupal what blocks are provided by the module, and
* generates the contents of the blocks themselves.
*/
function similar_block($op = 'list', $delta = 0) {
global $similar_node_nid;
// The $op parameter determines what piece of information is being requested.
if ($op == 'list') {
// If $op is "list", we just need to return a list of block descriptions. This
// is used to provide a list of possible blocks to the administrator.
$blocks[0]['info'] = t('Similar Entries');
return $blocks;
}
else if ($op == 'view') {
// If $op is "view", then we need to generate the block for display purposes.
// The $delta parameter tells us which block is being requested.
if ($similar_node_nid > 0) {