views module

views模块主要用来查询网站中数据(从哪个表查询数据,用什么条件过滤,取得哪些字段),并配置以何种format(list,table)及何种dispaly(page,block)来显示这些数据。

模块介绍

views首先是一个query builder.
query builder
在views editor中可以配置query及format。
views wizard
views UI

配置

  • Configure Views for debugging
    • 访问admin/structure/views/settings,选中[Show the SQL query]
    • 访问admin/structure/views/settings/advanced,选中[Add Views signature to all SQL queries]
  • 上线运行时停用views UI
    views模块包括views和views UI两个模块。上线运行时需要关闭views UI功能。

Usage

  1. choose what to query
  2. limit selection with filters
    • view modes or fields
  3. select and Configure formatting
  4. choose dispalys - and/or add attachments

学习资源

  1. A Totally Beginner Tutorial to Views for Drupal 7
  2. Views Mini-Course, Part I: An Introduction to Views
  3. Views Mini-Course, Part II: Creating Flexible Views with Drupal 7
  4. Views Mini-Course, Part III: How to Back Up Your Views Safely
  5. Tips and Tricks for Getting the Most Out of Views

练习

filters

format

dispaly

  • Demo: attachments [Views Mini-Course, Part II: Creating Flexible Views with Drupal 7]

Other

其他资源

Learn Views in Drupal 8
Views & SQL Analogy - An easier way to explain Views
drupal 官网Views guide