Intro to Views

Printer-friendly versionPrinter-friendly version

VIEWS TERMINOLOGY

  1. Content v. Fields: When a display is in the 'content' mode, view results can be shown in any of the standard ways they can appear on your site, such as teaser, title, or full. 'Fields' are the individual pieces of information that make up the elements (like content items, users, and comments) that appear in your view. If you switch a display to the 'fields' mode, you can choose which fields are shown in that display; for example the title, post date, author, images associated with the content, etc.
  2. Contextual filters: These filters can do several things, including changing your view dynamically depending on where or how your view is shown on your site. For example, the same view can show one author's most commented posts on their blog page and show another author's on theirs. Contextual filters can also act as meta-filters, filtering and displaying the items in your view based on information about them (meta information) rather than just information in them, which is what normal filters do. For example: you can sort and display how many posts were published in each of the last few months, based on a contextual filter that sorts and summarizes their post dates.
  3. Displays: These determine how your view is output, which could be a page, block, feed, or attachment. Every display can be individually configured and a view can have multiple displays, including multiple displays of any given display type. For example: you can build a single view that is displayed as a block, a page, and an RSS feed.
  4. Exposed filters: These allow your site visitors to customize the view they are looking at with one or more controls. For example, exposing the 'Sort criteria' filter allows visitors to order view results in ascending or descending order. Almost any filter criteria can be set to be 'exposed' to your site visitors.
  5. Filters: These are the basic selection criteria for what gets included in your view. Filters include characteristics like content type, published state, tags, content author, etc.
  6. Pager: When your view result contains more items than the limit set for a page or block display, you can add and configure a pager to link between multiple pages or to link from a short block display to a complete page display.
  7. Relationships: These add the ability to expand your view to include information from items that are not directly part of your view's results. For example, adding the relationship 'Comment: user' to a content view makes all the fields related to the authors of any comments made on that content available to your view, too.
  8. Views: A contributed module which is a simple interface for creating displays of various Drupal objects; like content, products, orders etc. Views permit selection of specific fields to display, filtration against various attributes, choice of basic layout options and other more advanced features.

UNDERSTANDING THE EDIT PAGE

You can always reach the 'Views' main page by navigating to: Structure > Views, from there you can edit a view by selecting the edit button to the right of the appropriate choice.

EDIT PAGE LAYOUT
The view edit page is divided into areas, each focused on a different aspect of your view: displays, content, and so on. Every link and drop-down control on the edit page lets you change or configure some aspect of your view.

  1. View controls: The controls at the top of the edit page manage your view. Each display (page, block, feed, etc.) has a button. Clicking a display button opens it in the editing area at the center of the page and in the preview area at the bottom.
  2. Display controls:

    1. Display details: The controls at the top of the display details area let you name, clone, and delete your display.
    2. Left panel: The controls in the left panel manage how the view results are shown in the display: title, format, content or fields, filters, and sorting.
    3. Center panel (Display settings): The controls in the center panel let you define the URL path, menu link, access (permissions), header, footer, and pager.
    4. Right panel (Advanced): The controls in the right panel let you define advanced aspects of your display: relationships to make more fields available to it, contextual filters to make it behaves differently depending on how it is used, 'No results behavior' or what to do when your view comes up empty-handed, and 'Other', which for most views, you will most likely never use.
    5. Preview area: The bottom area of the edit page shows you a preview of the current state of the selected display and should automatically update it as you make changes unless you deselect the Auto preview box. Each part of the preview also has pop-out gear menus that show you the current view settings and give you access to controls to make changes.

IMPORTANT VIEW TIPS

  1. Clone: If you are not familiar with Views, before making any changes to an existing view, we highly recommend that you 'clone' the view and try out your changes on the clone version first.
  2. Saving changes: All changes you make to your view on the edit page are temporary until you click Save. For example, if you change the sort criteria and click OK in its window, the change will be lost if you leave the main view edit page without clicking Save. We highly recommend that you save your work frequently - especially when you see the message 'All changes are stored temporarily. Click Save to make your changes permanent. Click Cancel to discard your changes.'
  3. Access: Under the 'Access' settings within the 'Page Settings', you can control who access to this view. By default this is set to 'none' meaning anyone on your site can acess the view you have created.
  4. Administrative names and descriptions: It will help you manage and identify your views and displays if you utilize the fields that allow you to add optional descriptions or names
  5. Apply options: When working in settings, always change the ‘For’ option from ‘All Displays’ to ‘This block (override)’ so that the changes you make only alter the block (or page) you are working on. The ‘Apply’ button should say 'Apply (this display)'.

CREATING A VIEW

Views is a powerful tool and you can create them with many different options. The instructions below guide you through creating a simple view with a page and a block display for one content type. Specifically, we’re creating a view page that will display all of our store mugs with the mug name and image and a block which will display one mug at a time.

Navigate to: Structure > Views

  1. Select ‘Add new view’
  2. Enter a name for the view
  3. Enter an additional description for the view (optional but recommended)

    1. Select the Description check box
    2. Enter your description - this description is displayed to administrators on the Views list page.
  4. Select what you want this view to display:

    1. Show - select an item from the list of available choices, for this example we’re choosing ‘Content’
    2. Of Type - select all or refine your view by selecting an individual category, for this example we’re choosing the content type 'Mugs'
    3. Sorted by - select the order in which you wish items to be displayed, for this example we’re choosing ‘Newest first’
  5. Determine if you want to create a ‘Page’ or a ‘Block’ and select the appropriate check boxes. For this example, we want to create both so we have selected both together.
  6. Configure the new page and/or block using the settings that appear:

    1. Page/Block title - This will automatically default the same name you entered previously in step 2. However, you can change it if desired. This title will be used in the display at the top of the page and in various parts of the browser.
    2. Path (only available for ‘Page’) - This will be the path used to navigate to the page you are creating - use the default or set a custom path
    3. Display format - Determine how this information is presented to your visitors:

      • Grid - A configurable table-like format (this is the option we’re choosing for this example)
      • HTML list - An ordered or unordered list with configurable CSS options
      • Jump menu - A menu listing of links to the view items
      • Table - A dynamic, configurable table with sortable columns
      • Unformatted list - A simple list of the view items without any CSS
    4. Select what to show on views of content:

      • Teasers or full posts -
      • Titles - content titles only
      • Titles linked to content items
      • Fields - sets which fields (title, body, author, etc.) will be displayed (this is what we’re choosing for this example)
    5. Items to display - Specify the number of items your view displays on a page, with a pager to navigate between them
    6. Use a pager - Allow site visitors to see additional results if there are more results than can be displayed on the page (based on the Items to display field)
    7. Create a menu link (only available for ‘Page’) - Add a menu link to any navigation menu of your choice on your site
    8. Include an RSS feed (only available for ‘Page’) - Add a feed to let visitors follow updates to your view
  7. Continue & Edit
  8. Select the ‘Page’ display
  9. Under 'Fields' select ‘Add’
  10. Select the Content: Image option that appears in the 'Mugs' content type
  11. ‘Apply this display’
  12. Configure the field accordingly to your desired preference and ‘Apply this display’
  13. Save
  14. Select the ‘Block’ display
  15. Under 'Fields' select ‘Add’
  16. Select the Content: Image option that appears in the 'Mugs' content type
  17. ‘Apply this display’
  18. Configure the field accordingly to your desired preference and ‘Apply this display’
  19. Save

NOTES:

  • Under the ‘Filter Criteria’ and ‘Sort Criteria,’ you will have fields already in place. Those options came from the choices you made during steps 4a through 4c. Additional options can be added by selecting the ‘Add’ button and choosing additional fields.

    • Content: Published (Yes) - Filter
    • Content: Type (=Mugs) - Filter
    • Content: Post Date (desc) - Sort
  • Under the 'Access' settings within the 'Page Settings' options, the default will be set to allow any user with the permission to view published content, to view the display created. You can change this access based on what content is being made available and who it is meant for. For example, using the view we created for 'Mugs', we could restrict it so that only users with an 'authenticated user' role can view the display.

    1. Under the 'Access' settings within the 'Page Settings'  select 'Permission'
    2. Select 'Role' - Apply (this display)
    3. Select 'Authenticated User' - Apply (this display)
    4. Save

You have now created a page that can be found following the path you created in step 6b.

The block you created is disabled by default. If you want site visitors to view the block, you must enable the block and place it on your website by navigation to Structure > Blocks and configuring the block to appear in the region of your choice and on the pages of your choice.

This concludes our review of 'The Basics of Views’. To learn more about the different types of views visit our 'Help Center' and select the 'Views (Advanced)' category.

 

IndieCommerce Help Documents

 

About ABA

The American Booksellers Association, a national not-for-profit trade organization, works with booksellers and industry partners to ensure the success and profitability of independently owned book retailers, and to assist in expanding the community of the book.

Independent bookstores act as community anchors; they serve a unique role in promoting the open exchange of ideas, enriching the cultural life of communities, and creating economically vibrant neighborhoods.

Contact

PRESS INQUIRIES: [email protected]

INDIECOMMERCE: [email protected]

ALL OTHER INQUIRIES: [email protected]

 

 

Copyright 2024 American Booksellers Association. BookWeb is a registered trademark of ABA.
Privacy Policy, Cookie Policy, Accessibility Statement