Due to the popularity of our web development contract template, we're offering the contract, estimate, NDA and invoice templates for $199.50 $49.50 if you order by March 17. Click here to learn more.
Constant Contact has been in business since 1996 is one of the most reliable and trusted email marketing services around. Click here to activate your free 60 day trial courtesy of CWD Community.
There used to be a module that did this, but I forget what it's called, and am unsure as to its compatibility with various versions of Drupal. The easiest and most direct way to place the contents of a block in a page are using the following PHP snippet:
<?php
$block = module_invoke('menu', 'block', 'view', 26);
print $block['content'];
?>
In this particular example, we're displaying a menu block with ID 26 inside a page. Here's how you use this code snippet to insert any block (this example uses Drupal 5.x; for other Drupal versions, the process should be similar):
This will reveal the following address line (in this example we are using a custom block with ID 26)
/admin/build/block/configure/block/26
the last two variables are the ones we're interested in: /block/26
If we wanted to place this custom block into a page, we would simply substitute these values into our PHP code snippet (which we place in a node (page or other content type)) as follows:
<?php
$block = module_invoke('block', 'block', 'view', 26);
print $block['content'];
?>
Notice that the middle two terms ('block', 'view') always stay the same. You're simply updating the first and last term.
Voila 
For the reverse method, displaying a node (such as a page) in a block, we recommend you use the node as block module.
Look no further than Lonex. You'll get a free domain name and all-inclusive web hosting services with added automatic ready-to-go website installation. With any of our hosting plans you get free installation of a popular script, such as WordPress (for your blog), phpBB2 (for your forum), Coppermine (for your photo album), osCommerce (for your e-shop), Joomla (for your CMS), and many more.
Each web hosting account includes a free 1-Click Installer. With the help of this user-friendly all automated scripts installation tool you are able to install any of the more than 30 popular PHP scripts available with just ONE mouse click. More importantly, you don't need to possess any Linux administration, web programming or web design skills. Simply choose a preferred web hosting plan, select a desired PHP script and... have an easy, quick and hassle-free website installation! Click here to learn more.
All Content © 2005 - 2010 Contract Web Development, Inc. All Rights Reserved. Privacy Policy | Terms of Use | Powered by Drupal
buenisimo!!!!!!!!!!!!!!!!!!
buenisimo!!!!!!!!!!!!!!!!!!
gracias
Placing a webform into another node - Possible?
I would like to place a webform form which is a node into a page/node. Is the code very similar to placing a block in a node?
Thanks
Rory
Webform description
Hi Rory,
I'm pretty sure it's possible, but you might be better off simply inserting what you had in the other node in the description field of the webform - it will take any input format, so you should be able to put just about anything in there.
Appreciated
Is the code very similar to placing a block in a node?
Thanks for the code.
Thanks for the code.
The first example does not work, because the word "menu" is there, when it should be "block".
Inserting Drupal Block vs. Menu
I probably should have made that more clear. The first example is for inserting a menu into a node, the second for inserting a block.
This is so simple, isnt there a module for this ...
i mean come on ...
Making a Drupal module
It is simple. If you want this installed as a module, why don't you learn how to create the module? Most Drupal developers are bogged down getting core functionality improved. This could be a good starting point for you to contribute to Drupal.
Drupal newbie
I like what I've read about Drupal so far and plan on experimenting around with it. In fact, I think I will give this a shot. Cool. Depends what I decide to do next with my email marketing business and if that's the direction I even want to go with it.
Number on drupal blocks in view?
Some of the blocks do not have a number on them. I made a view, but it didn't give it a number... I'm confused...
non-php version of this functionality
reptag module provides this sort of functionality through a filter.
Use markdown code like the following:
"{BLOCK:1}" => "user-defined block 1",
"{BLOCK:Contact Details}" => "user-defined block with the given title",
"{BLOCK:menu:2}" => "block 2 supplied by the named module",
"{BLOCK:image:Random image}" => "named block from the given module"
Pretty handy if you like it.
Some of the blocks
Some of the blocks do not have a number on them. I made a view, but it didn't give it a number... I'm confused...
Node-specific page template
I believe that the easiest way to do that is to use a node-specific page template. And if you want to display multiple nodes you can create templates for each of them.
I will keep this in mind
Interesting, when I'm ready to use Drupal and experiment around with it, I think I will give this a shot. Cool. Depends what I decide to do next with my email marketing business and if that's the direction I even want to go with it.
Good Drupal workaround
Makes everything looks easy with the workaround that you've shown us.
Drupal
Thanks for the great Drupal tips, will come in very handy!
Drupal node insert - input format?
When inserting a Drupal block within another Drupal block or node - does the input format get inherited (as with an iframe), or does the input format of the parent node override that of the inserted node or block?
Inserted content treated as iframe
Good question - the input format of the inserted node will apply to the inserted portion, while the input format of the parent node will apply to the rest of the node. In other words, the insert will be treated as an iframe.
Core Drupal developers bogged down
Most Drupal developers are bogged down getting core functionality improved. This could be a good starting point for you to contribute to Drupal.
DISPLAY
If you want to display multiple nodes you can create templates for each of them.
jollie
Cool
Thanks for the codes. U really did a good job.
Thanks for the script!
Thanks for the script! Indeed very helpful.
Is this code same as in blocking a node?
Thanks for sharing this code. But one question though. Is this the same as when you place a block in a node?
Thanks again.
Globat Reviews Guy
Block in node
Yes, that's precisely what it is.
drupal
Thanks for you the information on how to block drupal using drupal blocking mode.
node block
Thank you for the information on how to display block in node. Sharing these codes are really gonna be very beneficial.
Raghu
Hey,
Good Post. But instead of using the block id 26 can't we use the name of the block or some other parameter?
Use any id
Simply use the ID corresponding to the block you want to insert. There may be a way to do this by block name, but we haven't come across one yet.
Display suite module
The module Display Suite (DS) can do this for you.
Thanks for the snippet
Thanks for the snippet. I was trying to remember how to do that. Drupal always gives me a headache it seems.
Thanks
In the evening I usually save all interesting for me articles and read them either in the morning on my way to work or during the dinner break. When I fail to find free time though, I set articles in pdf format and download them.
My Drupal impression
I have been building my websites using Wordpress and other platforms and only recently came across Drupal. First impressions are that is has a clean presentation and is well supported with great tutorials.
Similar Entries Module Block
I want to include my block from similar entries module, but it doesn't simply have a number, but "configure/similar/0". Any idea on how to include this block? Great post, thanks!
Try 0
Did you try 0 as the number?
My code is like the visitor
My code is like the visitor that just posted:
configure/views/Prices-block_1
I tried using block id 1, but that did not work. I will try to figure out what its real id is... any good way to do this?
I tried
Thanks..
This works great but is there a way to pass in arguments?
I have created a view that requires an argument to be passed in. Can you pass in arguments using your code? Any help is greatly appreciated!
<?php$block = module_invoke('views', 'block', 'view', 26);
print $block['content'];
?>