'; $output .= '
'.'is_node_page'.'
'. t('Find out if the current page is a node page.') .'
'; $output .= '
'.'node_load_current'.'
'. t('Grab the current "active" node.') .'
'; $output .= ''; } return $output; } /** * Find out if the current page is a node page. * @return TRUE if the page is a node, FALSE if it is another page. */ function is_node_page() { if (arg(0) == 'node' && is_numeric(arg(1))) { return TRUE; } return FALSE; } /** * Grab the current 'active' node. * An active node is the one node 123 as shown on page with path node/123, or * its aliased path(s). * @return $node object if the page is a node, empty $node object if it is not a * node, or if we cannot see it, for any valid reason. */ function node_load_current() { if (is_node_page()) { if (!is_object($node = menu_get_object())) { $node = node_load(arg(1)); } } else { $node = new stdClass(); } return $node; }