1

I would like to be able to use a region which is to contain the title of the current node. In the default theme the title is output in the main content, but I want it in this custom region instead. But I cannot find a block for the node title. Can I create it?

  • It's not a real answer in that it doesn't involve a block, but The Scary Render Array might give you an alternative method. – Andy Jul 20 '12 at 8:39
3

Remove the title from the node.tpl.php and create a new block with the following PHP code:

<?php
$node = node_load(arg(1));
print $node->title;
?>

Enable visibility only on view node pages.

CCK Blocks is a very handy module for these things, but unfortunately the node title isn't listed as an element in display mode.

[EDIT]

If you are on D7 and you are using Omega theme, Delta module should work for you. Check specifically Delta Blocks module from that package.

  • Ok, I have never created a block in code so far, I have only selected blocks available. So where do I create a block, in a new php file? – Anders Svensson Jul 19 '12 at 20:14
  • First step: make sure the PHP filter module is enabled. Second: create a new block and elect "PHP" as filter input and paste the code from my message. – Aram Boyajyan Jul 20 '12 at 7:21
  • I just remembered of another module that might help you. Check my post above. – Aram Boyajyan Jul 20 '12 at 7:26
0

You could create a new block with the hook_block_ ... hooks.

Here's a block example how to do this. In hook_block_view, you can define the node title in $block['subject'].

Have a look to the code sample from Ivanhoe123 how to get the node title.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.