Last updated March 26, 2011. Created by JohnNoc on July 27, 2007.
Edited by linclark, LeeHunter, Morris Singer. Log in to edit this page.
This example assumes that you have downloaded the views_multiblock module, the views_argument_api module, the views module, the views_ui module (which comes with views) and the taxonomy module. You will need to enable all four of these modules. You will also need at least one node type to work with, one vocabulary (with at least one term in it), and nodes that are classified somewhere in that vocabulary.
- Download and install both the views_multiblock module and the views_argument_api module. Also, ensure that you have the Views module enabled as well as the Views_UI module enabled.
- Go to admin/build/views and either a) add the views_multiblock view (and make some changes as necessary) or b) create a new view. I recommend option a.
- When editing your view, ensure that you have at least one argument set up with the view. The most common application of this is to add a Taxonomy: Term ID argument. We'll use this as our example. Click the button at the bottom of the page to save the view and continue editing it.
The purpose of this argument is to provide what amounts to a wildcard in the view query. In other words, you create a query with Views that says something along the lines of "Show me all nodes of the story node type that are published, where the Taxonomy: Term ID is equal to X," and then you can set up Views_Multiblock to fill in X differently for each block you create with the Views_Multiblock module.
- Go to the bottom of the edit view form and open the Argument API fieldset. Select a method for passing the Taxonomy: Term ID to the view. For the purposes of this example, instruct it to select a pre-defined value. (What this does will become clear in a moment, hopefully.
- Save your view.
- In admin/build/block, locate an existing views_multiblock block. There are generally five disabled blocks at your disposal, unless you change this in admin/settings/views_multiblock. Pick one of the existing, disabled views_multiblock blocks (denoted by the appended [vm]), and configure it. In the block configuration, most of the options should be self-explanatory.
- I should, however, explain what to do with the Views fieldset. Pick out the view you defined in the previous steps. Click Update.
- Now, if you scroll down to the Views fieldset, you will see a form element to select a Taxonomy: Term ID to pass to your view. If you had picked a different setting in the views edit form under the Argument API fieldset, you would see something different here. Feel free, after we complete this example, to try some other, perhaps more interesting and more powerful options there and see how it affects this fieldset in the block configuration form.
- Pick a term for this form element and submit the block configuration.
- Go back and configure as many views_multiblock blocks as you would like. If you need more, go to admin/settings/views_multiblock and select a different number of views_multiblock blocks that this module should provide. The theory here is that you have pre-defined a view (or a few views) to use with these blocks, and you are filling in the wildcard (see above).
- Now, place the blocks in the desired regions and submit the form at admin/build/block.
That's it. You should see your blocks.