Views

Primary tabs

Important, basic points about views:

  • Using views, you can create a particular look at already existing data, e.g. a list of tags.

  • The same view can have several displays, meaning the same look can exist in multiple formats, e.g. both as page and feed.
  • Under Fields we can choose which fields will be shown or used in other ways (like a later comparison).
    • Fields, add, remember to use Search and the Filter, it makes it much easier to find the field you need to add to your view
    • Configure field
      • Exclude from display, precisely if you don't need to display this field, but need it for some other reason
      • Link this field to the original piece of content will sometimes be displayed, this is a simple shortcut for linking from a field back to the content, this field is from.
      • Rewrite results
        • Output this field as a link, if you want to create other kinds of links
          • Use absolute path, very good for links in rss feeds
    • Sort criteria
      • Expose this sort to visitors, to allow them to change it, if you enable this, you will get a filter
  • When an included field is a (term?) reference, a link to the relevant page will be created automatically or by default (e.g. from term to page of content linked to term). It is also possible to include the linked to content.

If you're used to SQL, this might help you:

select from where order by

If the value for filtering comes from the URL, use Contextual filters:

  • The view is available as a page, with a path: www.example.com/my-view
  • I want to get the term ID from the URL, if it's available, and only show content matching that term.
  • Contextual filters, add
  • Choose the right field, apply, apply.
  • A relevant term has tid = 7.
  • Test www.example.com/my-view/7

If fields are needed from more than one entity, relationships are needed, like this:

  • I want to create a view showing articles + the name of the author.
  • Create a view showing articles.
  • Create a relationship to Content: Author.
  • Now you can select a new field: User: Name.

Using relationships is like joining tables in SQL.

Want to display your content with a view included? Use Viewfield. Viewfield Tutorial. This applies, when you actually want to link youre content to a view. You can also use Views field view, where you can still use another view a field, without relating it to your content type.

Have a hierachal taxonomy structure? Then of course you want to show it hierachally in your view. Use Views tree.

  1. First, create a new term view using the fields row style. Then:
  2. Add relationship for taxonomy term: parent term
  3. Add field term id (do not use relationship) and exclude it from display
  4. Add field term id with relationship, exclude from display
  5. Add any fields you want to display, like term name, term description, etc...
  6. Change style plugin to Tree (Adjacency model)
  7. Set Main field to Term ID
  8. Set Parent field to Term ID with parent relationship

0, "the fields row style". What is actually meant is "unformatted list of fields".

1, find and relate to the parent term.

2, add field term id.

2, without relationship, excluding from display.

3, again, now with relationship.

5-7, change style (or rather, format).