ASU Web Community

Views: Create Page View of Nodes by Term ID

If you want to display a list of nodes (or content) by term id (or category) and you want to call specific lists on specific pages, there are two ways to accomplish this. The easiest is to create a view and directly call the views on the page. For example, say we want a list of the most recents news items of the catgeory "Dept. A" to appear only on Dept. A's pages, those categorized as "Dept. B" to appear only on Dept. B's pages, etc. Here's a way to accomplish this using the Content Construction Kit (CCK), Views, and Insert Views modules.

  1. In CCK, create a new content type called "news."
  2. In Categories, create a new vocabulary called "News." Add terms, one for each department.
  3. In Views, create a view called "dept_news."
    1. In the Page section:
      • Check "Provide Page"
      • Create a URL alias, such as "views_dept_news"
      • Set "View Type" to "List View"
      • Title can be left blank or filled in.
      • Nodes per Page: set to number of articles you want displayed

      Page section

    2. In the Fields section:
      • Add field "Node: Title"
      • Add field "Node: Body" and select "Teaser"

      Fields section

    3. In the Arguments section:
      • Add the argument: "Taxonomy: Term Name" and set Title to "$arg News"

      Arguments section

    4. In the Filters section:
      • Add "Node: Type" is one of "News"
      • Add "Node: Published" equals "Yes"

      Filters section

    5. In the Sort Criteria section:
      • Add "Node: Created Time" Descending and Normal

      Sort Criteria section

  4. Go to the node (content or page) you want the views to appear on and add the view. The values you can set are:

    [view:name of view] is replaced by the content listing, and
    [view:name of view=x] limits the listing to a particular x number of entries.
    [view:name of view=x=arg1] limits the listing to x entries and passes arg1

    Example:
    [view:dept_news=3=Dept. A]
    Three nodes of the content type "dept_news" that also are tagged (or categorized) with the term "Dept. A" will be printed.

  5. You can insert as many different views on the same page as you wish.
    Example:
    [view:dept_news=3=Dept. A]
    [view:dept_news=3=Dept. B]
    [view:dept_news=3=Dept. C]