Are there any function for getting parent node of current node?
i.e. nodehierarchy_get_parent($nid);

Comments

divined’s picture

Category: task » support
divined’s picture

function nodehierarchy_get_parent($nid = NULL) {

$sql = sprintf("SELECT link_path FROM menu_links WHERE p1 = (SELECT p1 FROM menu_links WHERE link_path = '%s') AND depth = 1",'node/'.$nid);
$pid = db_fetch_object(db_query($sql));
$output = str_replace('node/','',$pid->link_path);

return $output;
}
jbylsma’s picture

Status: Active » Fixed

There's a whole bunch of functions starting around 1200 in 6.x-2.x. You'd probably want to use nodehierarchy_get_node_parent_nids() and pass the current node's nid.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

error