You need Views if:
- You like the default front page view, but you find you want to sort
- You like the default taxonomy/term view, but you find you want
to sort it differently; for example, alphabetically.
- You use /tracker, but you want to restrict it to posts of a
- You like the idea of the 'article' module, but it doesn't
display articles the way you like.
- You want a way to display a block with the 5 most recent posts
of some particular type.
- You want to provide 'unread forum posts'.
- You want a monthly archive similar to the typical Movable
Type/Wordpress archives that displays a link to the in the form of
"Month, YYYY (X)" where X is the number of posts that month, and
displays them in a block. The links lead to a simple list of posts for
Views can do a lot more than that, but those are some of the obvious
uses of Views.
Create the view
Go to Create Content > Page and create a Page with the title Poems List and with the url alias poemas , this url alias is very important to associate the Block View with THIS page.
Go to: Home > Administer > Site building > Views
Click Add to create a new View
View name: Poems_list , View description: poems listings, View type: Node. Click Next.
Select ‘block’ in dropdown box, click ‘Add Display’.
In Basic settings:
Click on ‘10′ next to ‘Items to display’ and change it to 5.
Click on the Block > Add fields. check to select Node: Post date, Link Node and Node: Title, then click the Add button . The next steps take you through more options for each of these fields.
Empty the content of Labels, so you wont't see repeated "Post date" on every line.
Remove the label of ‘Title’ (clear the text).
Check the box ‘Output this field as a link’ , scroll down and check ‘Link this field to its node’. that will make the poem's name a link to the poem itself.
Once you are done Click the ‘+’ sign next to 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 poems (Node: Type = ‘Poems’). Then click Add.
Ah, you will see in the preview the poems list only.
Is in't it beautiful?
Well, now set the sort order field, Click on Sort criteria to order by Post Date, and that's it
Add block to the page
- Go to Administer/Site Building/Blocks
Scroll down to the list of inactive blocks and find the one named ‘Poems_list’. This is what we created when we built our view in the previous steps.
- Click on the dropdown box and select ‘Sidebar last’ (or maybe ‘Sidebar right’ or ‘Sidebar left’ – depending on your active theme).
- Click the ‘Save blocks’ button at the bottom of the page.
The list of blocks will be refreshed. The news_list block now appears under the ’sidebar last’ heading.
- Click on the ‘configure’ link.
Type a ‘block title’ of Poems List
Scroll down to ‘Page specific visibility settings’ and click on ‘Show on only the listed pages’ and type in the text box poemas . This ensures that our block of listed news items only appears on the poemas page, on the content top side of the page.