I want to print a block directly in page.tpl.php. to do this, I need the block id number. Where do I find this?

Comments

mkabot68’s picture

Blocks are uniquely identified by the combination of "module name", "block id" (relative to module), and "theme name". There is not singular block id like there are for nodes/menus/etc....

If you go to Administer/Blocks and hover over the "configure" link for the block you want, you will see the "module name" and "block id" at the end of the URL.

Silly question - what would prompt you to HARD CODE a block into the template vs. just selecting the pages you would like to see the block on via the admin screens in Drupal?

mwu’s picture

hi,
that didn't work for me
i get
admin/block/configure/user/3

for example
0 is the number for bookreview, book, profile, statistics
1 is the number for block.

regarding why, perhaps i don't know the shortcut,
but if i put 2 blocks in the header region,
they are on top of each other,
and i want them next to each other

mkabot68’s picture

admin/block/configure/<module name>/<module block id>

Its the right format

In this case <module name> = "user" since I am assuming you created a custom block through the Admin UI

There are a couple of modules that help with placing blocks in places that the standard Drupal core doesn't, you might want to check them out.....

mwu’s picture

thank you.

sorry for being so ignorant. i thought i was pretty familiar with the modules. I don't know of modules that place blocks. is it possible for you to list some? thank you.

mkabot68’s picture

Dashboard - http://drupal.org/project/dashboard

Block Bar - http://drupal.org/node/36373

Insert Block - http://drupal.org/project/block_tags (from what you've said about your requirements, this is probably the one to look at)

mwu’s picture

thank you. you have very good knowledge of the modules!

I tried to install insert bar module.
I guess it was meant for people much more advanced, since it doesn't have any instructions.

It says, just put this code where you want the block.

[block:name of module=delta of block]

e.g.
[block:user=3]

I put it into a story, and it did work.
but I want to put it into the theme.
I tried putting it in page.tpl.php but it didn't work.

where would I put that code? I guess it must be obvious to a programmer since it was not explained.

TelFiRE’s picture

That doesn't mean it's obvious, it just means that most programmers are absolutely horrible at documentation.

nevets’s picture

When you create a custom block from administer -> blocks -> add block (tab), the module type is 'block'