function nodehierarchy_previous_sibling_nid in Node Hierarchy 6
Same name and namespace in other branches
- 5 nodehierarchy.module \nodehierarchy_previous_sibling_nid()
Get the previous sibling of the given node.
2 calls to nodehierarchy_previous_sibling_nid()
- nodehierarchy_previous_sibling in ./
nodehierarchy.module - Get the previous sibling of the given node.
- theme_nodehierarchy_children_list in ./
nodehierarchy_theme.inc - Return a themed list of items.
File
- ./
nodehierarchy.module, line 914
Code
function nodehierarchy_previous_sibling_nid($node) {
if (@$node->parent !== NULL && @$node->order_by) {
$sibling = db_fetch_object(db_query("SELECT h.nid FROM {nodehierarchy} h WHERE h.parent = %d AND h.order_by < %d ORDER BY h.order_by DESC LIMIT 1", $node->parent, $node->order_by));
return @$sibling->nid;
}
return NULL;
}