Place block in node in 6.x

bcarlson33 - March 18, 2009 - 02:19

Hi everyone,

Could anyone help me work through a way to add the contents of a block to a node in Drupal 6.x through a PHP call?

The code at this site -

http://community.contractwebdevelopment.com/drupal-block-in-node

<?php
$block
= module_invoke('block', 'block', 'view', 26);
print
$block['content'];
?>

- worked great in 5.x, but when I plug it into my Drupal 6.x site, I get this error message:

Parse error: syntax error, unexpected '>' in /home/livingin/www/www/includes/common.inc(1648) : eval()'d code on line 1

I know a tiny, tiny bit of PHP so I'm not clear on what this means or what to do about it. I've tried other workarounds but for the project I'm working on, this is the way to do it - assuming it can be done.

Thanks in advance for your help!

That would imply you have a

nevets - March 18, 2009 - 03:34

That would imply you have a custom block with delta of 26. Visit the block admin page and click the 'configure' for the block you want to show in the node. The path part of the url will be something like 'admin/build/block/configure/block/1', the 'block/1' is the part you want to check, 'block' is the module, '1' the delta. In general terms the call is

module_invoke($module, 'block', 'view', $delta);

So you want to use the values you found above for $module and $delta.

Where have you placed the code, either there is a error in the code or you have a custom block with PHP code that has an error.

That's what I had

bcarlson33 - March 18, 2009 - 10:33

I should've clarified - I did change those values out to the ones specific to the block I want to display.

The error then implies a PHP

nevets - March 18, 2009 - 15:29

The error then implies a PHP error in the code where you are making the call or in the block (only applies if block contains PHP code).

Solution

bcarlson33 - March 18, 2009 - 23:07

I just found the Insert Block module and it does what I was looking to do.

Thanks very much for the help!

 
 

Drupal is a registered trademark of Dries Buytaert.