Creating View Page

Hands on:  create a view and display it in a Page.

Let's say that you want a page that will display a paginated list of the latest news in your site, here is how to do it.
Providing you've created already a content type 'news', otherwhise you can check on this article http://freedelta.free.fr/r/learning-drupal/drupal-content-types/ to learn how to do it

 

Step 1: Create a View with display Page

 

  • Go to Administer > Site building >  Views
  • Click Add at the top of the views page, then enter 'news':  as the Name.
  • Click Add at the top of the views page, then enter 'Latest News':  as the Description.
  • Check View Type: Node. Click Next
  • Select Defaults > Page, and click Add display
  • Page setting, Path: news
  • Click on Fields [+] to add fields to the View, Check on Node: Title and Node: Post Date and click on Add. (If you install imagefield, imageapi and imagecache modules you can create views with thumbnails images!)
  • For each field you need to configure it, so Empty the Label content if you don't want to see "Title:" at the header.
  • Configure Node Title: check Output this field as a link and Link this field to its node.
  • Click on Filters [+] Scroll down and check Node: Published and Node: Type. These options let us choose to display only Published content (Node: Published =
  • Y), and only news (Node: Type = ‘News’). Then click Add.
  • Configure this filter setting as you wish, in my case I've checked on the Node Type: news, to show a list of my News.
  • To have full pagination go to Basic settings, Use pager: no, click on no to change it to Full Pager

Click on SAVE

 

 

One of the best things is that if you want to make another view like this one, where you will change some parameters only you can clone this one and take it for a start.

 

Step 2: Create a menu item

 

You can configure a menu item from the Views form itself, otherwise you can create a menu by linking the page to amenu item.

To link the page to a menu item, read here how to create a menu item

http://freedelta.free.fr/r/learning-drupal/creating-menus/

 

Then in the url path file write: news.

If you want to make it your home page then:

  • Under the administrator menu, select Administer >
    Site configuration > Site information.
  • Change Default home page to 'news', then click
    Save configuration.

That's it!

http://freedelta.free.fr/r/learning-drupal/drupal-content-types/