I have a block that I want to hardcode on the page. I want it to be a block so content authors can edit it. I want it hard coded because there will never be a situation where the block should not be on the page. How can I manually render a block in the php template?

Comments

nevets’s picture

It sounds like you want to use a module like Node As Block and use the block admin page to assign the block to a region.

jeffrod’s picture

i already have the block i need. how would node as block make it easier to hard code in the template?

nevets’s picture

Hard coding blocks in the template is a bad practice.

jeffrod’s picture

Could you elaborate on that? Why is hard coding blocks a bad practice? Do you have any links to articles that talk about why?

gjangelo’s picture

in drupal 6, this code works

$block = module_invoke('block', 'block', 'view', 38);
print $block['content'];

source:
http://drupal.org/node/145091#comment-939187

markpetherbridge’s picture

This has worked for me, however with a slight problem, The block input type is PHP and yet the PHP inside is not working, it is as though its only reading the HTML and displaying the PHP as text. - any solutions?

nevets’s picture

What does the code look like in the block body?