30 November 2010

This tutorial shows how to show multiple nodes on one page. Just like front page but not with a checkbox but different content type. Views are used for this.

Get Necessary Module:

This one requires only one module called Views.

List Nodes Dynamically:

To create list of nodes we use views module. So you have to enable it from Administer - Site building - Modules. Lets make a news page for an example. Where you can post news and view first 5 with pagination.
  • Create new content type for our news. You can get it from Administer - Content management - Content types - Add content type or example.com/admin/content/types/add from the address bar if you have clean urls enabled.

    · Name - lets call it to "News".
    · Type - machine-readable name would be "news".
    · From "Workflow settings" you can unselect "Promoted to front page".
    · Description - is a brief description of this content type that will be displayed as part of the list on the create content page.
    · Explanation or submission guidelines - i don't think that

    When you press "Save content type" then the new content type will be made.
  • Add news so we could test the results. You can add news from "Create content". We need at least six, so we cloud do a correct testing.
  • To build views we first have to enable "Views" and "Views UI" modules from Administer - Site building - Modules or example.com/admin/build/views. Then we can create views. Go to Administer - Site building - views or example.com/admin/build/views. Lets add a view by clicking add tab.

    · View name - is the unique name of the view which must contain only alphanumeric characters and underscores(i named it to "news_view").
    · Press next and we go to another, more complicated place.
    · Add a page - from left part of the table.
    · Change row style to Node to display the whole node.
    · Change items per page to five and make sure that use pager is turned on.
    · Now we have to add some filters, so we get only our news content.
    · First lets make it select only our news content type. Under node group select Type, add and select our content type.
    · You also might want to select Published filter under Node group. So the content would only show when published witch is our default value.
    · If you use multiple languages you also want to turn on language filter. Set the value to current user language.
    · Final settings would be Path and Menu. Path is the url, I make that to news. Optionally you can make a menu for it. I am using it on my home page so I don't need a menu. I have to set it from Administer - Site configuration - Site information or example.com/admin/settings/site-information
  • You can theme it and adjust it any way you want to get the result you desire.