views:

23

answers:

1

How can I print a nodes $links in a sidebar? What function can I call to retrieve them from outside the node.tpl.php and print them? I am still on the node. Also, I can't use Panels.

A: 

From the template_preprocess_node function:

$variables['links'] = !empty($node->links) ? theme('links', $node->links, array('class' => 'links inline')) : '';

You may want to alter the theme function a bit for your use case. I haven't tested how this works with other modules, but if they use the node object instead to add their links it should be fine.

googletorp
Yeah, I will try this. The tricky part is I need to split some links out of the $links, and leave others below the node (Read more, comment, etc)
Kevin
You can use hook_link_alter() to conditionally hide links. You could also use $links = module_invoke_all('link', 'node', $node, $conf['teaser']); modify the resulting array, and theme it yourself.
Grayside

related questions