Views
-
Upload
james-stone -
Category
Technology
-
view
467 -
download
3
Transcript of Views
Introduction to Views
Views-6.x-2.12Cleveland Drupal User Group
Presentation - 02/05/2011
Default Content Types Available to Us "Out of the Box"
• A page, similar in form to a story, is a simple method for creating and displaying information that rarely changes, such as an "About us" section of a website. By default, a page entry does not allow visitor comments and is not featured on the site's initial home page.
• A story, similar in form to a page, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a story entry. By default, astory entry is automatically featured on the site's initial home page, and provides the ability to post comments.
Drupal "Out of the Box"
requires a database for everything it does
pieces of content
lists of contentskeleton of every site
Pieces of Content
CCK (Content Construction Kit) is a small group of modules that assist in the creation of new fields for content types. Drupal core allows us to create a content type, and CCK adds the fields we want to have in that content type to make it suit our needs. This allows for the ultimate in flexibility and customization. CCK exposes data.
Lists of Content
Views is a module that provides a flexible way to control how lists and tables of content are presented. The Views module is a powerful tool to display, sort, and filter content. Views are considered to be the building blocks of content. Views can even sort and filter data "on the fly" with exposed filters. Views displays data.
What is Views?
• query builder• retrieves a list of content &
displays it• can power a lot of the site• let's us choose a lot of
display info in the UI• has a lot of theming power• takes SQL statements and
hides them behind a clickable UI
• we don't need to know PHP
• we can change behavior without changing code
• UI interface• built in data safety• export capability• tight integration with many
modules• exposed widgets
Advantages
Disadvantages
• it is not as optimized as it could be
• might not be able to produce the query we want
Non-developers can get some very custom fields.
Developers have a quick and easy way to add functionality without starting from
scratch.
users, nodes, comments, images, taxonomy terms
fields (titles, names, body), filters (criteria, color, type), sorts (how we want it organized), arguments (custom URLs and other filters), relationships (pulling in information from other sections of the site
table, ordered list, unordered list, grid
How the UI Relates to the SQL Query
Fields - which fields from my result set we want to display
Filters & Arguments - allow us to adjust and fine tune the result set to the results we want
Relationships - used to tie in additional data that can help filter it further
Sort - allows us to adjust how things are ordered
SELECT
WHERE
JOINS
ORDER BY
About Joins in Views
Drupal is only concerned with joins that relate data between two tables; we have access to LEFT JOIN and INNER JOIN.
A LEFT JOIN returns all the rows from Table A and the all the rows from Table B even when there is no match. An example is to "find all nodes posted by a user, and display the username and node title".
An INNER JOIN returns all the rows when there is at least one match in both tables. An example would be to "list all users with any orders".
Resources for Event Management Viewhttp://drupal.org/project/viewshttp://drupal.org/project/datehttp://drupal.org/project/calendarhttp://drupal.org/project/flag
http://drupal.org/project/signuphttp://drupal.org/project/locationhttp://drupal.org/project/gmap
http://www.doitwithdrupal.com/files/u3/UsingDrupalch09.pdf