Hi Malte,
I think your problem is that you're passing in the package ID (which is what closest_ancestor_package returns) rather than the node ID. I have a master template which achieves the functionality you want. The relevant code snippet is below (I think this was originally from group-master.tcl in acs-subsite):
# Find the subsite we belong to
array set subsite_sitenode [site_node::get_from_object_id \
-object_id [ad_conn subsite_id]]
set subsite_url $subsite_sitenode(url)
set subsite_node_id $subsite_sitenode(node_id)
set subsite_name $subsite_sitenode(instance_name)
# Context bar
if { [template::util::is_nil no_context_p] } {
if { ![template::util::is_nil context] } {
set context_bar [eval ad_context_bar -from_node $subsite_node_id $context]
}
if [template::util::is_nil context_bar] {
set context_bar [ad_context_bar -from_node $subsite_node_id]
}
} else {
set context_bar {}
}
HTH, Tom