Reputation: 2389
I'd like to do in
node.tpl.php
How to pass a variable from a node to a block?
Upvotes: 1
Views: 3660
Reputation: 12157
do some processing of node fields in
node.tpl.php
A purist would say that you shouldn't be doing it there. hook_node_load() can be used for processing of fields.
Then you can just use menu_get_item() in your block to get the $node
object and access any values you have added to it.
Upvotes: 1
Reputation: 3388
Since you're running Drupal 7, you have access to the new hook_page_alter() function, from either a custom module or theme. By implementing this, you can easily move parts of the main content area (eg, the node), into any number of different blocks. You'll want to use the show(), hide() and render() functions to properly hide content.
Alternatively, using show() and hide() from within your node.tpl.php template should properly hide the elements, and then you could grab the node object from your block using the menu_get_object() function.
There is normally a video available on hook_page_alter() here, but the site is down at the moment.
Upvotes: 3