Posted by jdesrig on June 21, 2012 at 8:58pm
I want to put a link in a block which will pull its url from a url field in the node being displayed on the page on which the block is. Meaning, the block will contain a different url for each different node-info page. How can I reference this node in the block?
Comments
Start with hook_block
Hi,
I didn't understand all of your requirements. However, for Drupal 6 you'll need to implement hook_block (to display custom content in a block). The api docs are here http://api.drupal.org/api/drupal/developer%21hooks%21core.php/function/hook_block/6.
That should get you started. Once you've made some progress, you might have so more detailed questions.
Hope that helps :)
Good Luck.
When in doubt, have the Leprechaun take care of it!
use arg() function
In your block code use following conditions of example
<?phpif (arg(0) == 'node' && arg(1) != 'edit') {
$arg = arg(1); // this gives you nid of node .
$node = node_load($arg);
$field = $node->your_feild;
}
?>