A common use case is to include the contents of a particular view in all nodes of a particular content type. The following example shows how to do that.
In this example we work with a view that takes a single nid argument to display a list of references for an article.
- Download, install and enable the Views, References (Drupal 7) or CCK Node Reference (Drupal 6), and Viewfield modules.
- Create a content type Article.
- Create a content type Article Reference that contains a node_reference field. Restrict the field to only allow references to Article nodes. Make some test Article Reference nodes, linking them to articles by supplying appropriate node_reference values.
- Create a view named 'article_references' that displays Article Reference nodes. Add a content argument / contextual filter that refers to the node_reference field, and make views validate it as an Article nid. Test the view with an Article nid to make sure it correctly displays references for the article.
- Add a field of type Views to the Article content type.
- Specify 'article_references' as an allowed view.
- Supply a default value of 'article_references'. In the arguments textfield enter
[node:nid](Drupal 7) or
- Click 'Always use default value'. This will automatically assign the default value when each node is saved, and will hide the viewfield on the node edit form so it doesn't distract authors.
- View an article. You should see a list of the references for that article in the node content.