Download the agency overview...
View our Agency Overview
Agency Overview

Expert Resources

Insert Drupal blocks/views into node content easily

Have you always wanted to move that Drupal block or view over into the content, but always felt it might be difficult to do so? Well if you didn’t know already, there are modules that will do just that. Those two modules are Insert Block and Insert View. Both modules provide an easy short syntax that will allow you to insert a specified block or view into your content easily. With both these modules you are given more flexibility to place block/view content on specific areas instead of standard block areas or view pages, which is limiting.

Insert Block

Insert block installation is simple just install and enable. In order for you to use it within your content, you’ll have to make sure it is included as part of your Input Formats for your code filters. Once you get that all setup, your in business. When inserting a block on page you’ll need to follow this simple syntax:

[block:name of module=delta of block]

Example:

[block:block=49]
This will insert the content of block 49 onto my page content.

or

[block:google_cse=0]
This will insert the Google CSE block onto my page content.

Definitions

Name of module – Depending on the block your using it may be based on a module that created it, for example the Google CSE module creates a block for Google CSE and its name of module will be “google_cse”.
Delta of block – The “delta of block” essentially is block number, this can be found if you hover over the configure link:

http://www.sitename.com/admin/build/block/configure/block/49

Module Link: http://drupal.org/project/insert_block

Insert View
Just like insert block simple to install and enable; don’t forget to include it in the Input Formats so that it can be used in your content. The syntax for inserting views into your content is similar:

[view:name of view]

[view:name of view=name of display]

[view:name of view=name of display=x=arg] x – is the list of items; arg – is an argument for the view

Example:

[view:news_list]
This will insert the view news_list into the content, it will choose the default display to list the content.

[view:news_list=block_1]
This will insert the view news_list into the content, but will use the block_1 display of the content.

[view:news_list=block_1=4=2009]
This will insert the view news_list into the content, but will use the block_1 display of the content, but will show only 4 items and will only show content related to year 2009.

Definitions

Name of view – this is the name of the view you want to use or view name
Name of display – there are multiple choices for display for one view, so you can specify a specific display for that view
X – you can specify a number of items the view should show
Arg – you can specify arguments for the view if it needs to display certain items; you can add multiple arguments as long it is support by the view (see module page for further detail on arguments)
Module Link: http://drupal.org/project/insert_view

Conclusion

So, there you have it two simple and quick modules that will help make inserting blocks and views into your content easily. Both modules will definitely provide more flexibility for you and options to place your content.

Also, if you find any similar module or know of a better module that will do the same or provides better features, I’d like to hear about it. Please share in the comments. And a “Thank you” in advance.