tags:

views:

179

answers:

2

Hi,

I'm needing to dynamically display the title of a node within a block. I would have thought this would be simple, but all the code snippets I've tried don't seem to work (e.g. <?php print $node->title; ?> )

I've checked and tested that the PHP input format is on and working with other PHP bits and bobs, and everything seems OK.

Any ideas?

+2  A: 

I thik this link might be of help:

http://www.g-loaded.eu/2009/05/07/drupal-tip-list-a-nodes-taxonomy-terms-inside-a-block/

Based on it:

if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
    $node = node_load(arg(1));
    echo $node->title
}
Tomasz Struczyński
drupal.api already has function for it: $node = menu_get_object(); print $node->title;
Nikit
+1  A: 

There is also the option to use the views module for this.

nenne