Projet

Général

Profil

Paste
Télécharger (4,75 ko) Statistiques
| Branche: | Révision:

root / htmltest / sites / all / modules / views / help / about.html @ a5572547

1
The views module allows administrators and site designers to create, manage, and display lists of content. Each list managed by the views module is known as a "view", and the output of a view is known as a "display". Displays are provided in either block or page form, and a single view may have multiple displays. Optional navigation aids, including a system path and menu item, can be set for each page-based display of a view. By default, views may be created that list content (a <em>Node</em> view type), content revisions (a <em>Node revisions</em> view type) or users (a <em>User</em> view type). A view may be restricted to members of specific user roles, and may be added, edited or deleted at the <a href="base_url:admin/structure/views">views administration page</a>.
2

    
3
For more technical users, views can be understood as a user interface to compose SQL-queries and to pull information (Content, Users, etc.) from the database and show it on a screen as desired.
4

    
5
The "building block" design of the views system provides power and flexibility, allowing parameters to be specified only when needed. While an advanced view may use all of available parameters to create complex and highly interactive applications, a simple content listing may specify only a few options. All views rely on a conceptual framework that includes:
6

    
7
<ul>
8
  <li><a href="topic:views/field">Fields</a>, or the individual pieces of data being displayed. Adding the fields <em>Node: Title</em>, <em>Node: Type</em>, and <em>Node: Post date</em> to a node view, for example, includes the title, content type and creation date in the displayed results </li>
9

    
10
  <li><a href="topic:views/relationship">Relationships</a>, or information about how data elements relate to one another. If relationship data is available, like that provided by a CCK <em>nodereference</em> field, items from a related node may be included in the view </li>
11

    
12
  <li><a href="topic:views/argument">Arguments</a>, or additional parameters that dynamically refine the view results, passed as part of the path. Adding an argument of <em>Node: Type</em> to a node view with a path of "content", for example, dynamically filters the displayed items by content type. In this example (shown with Clean URLs enabled), accessing the view through the path "<em>http://www.example.com/content/page</em>" displays all posts of the type "page", the path "<em>http://www.example.com/content/story</em>" displays all posts of the type "story", and "<em>http://www.example.com/content</em>" displays all posts regardless of type) </li>
13

    
14
  <li><a href="topic:views/sort">Sort criteria</a>, which determine the order of items displayed in the view results. Adding the sort criteria <em>Node: Post date</em> (in descending order) to a node <em>view</em>, for example, sorts the displayed posts in descending order by creation date </li>
15

    
16
  <li><a href="topic:views/filter">Filters</a>, which limit items displayed in the results. Adding the filter <em>Node: Published</em> (and setting it equal to "Published") to a node view, for example, prevents unpublished items from being displayed</li>
17

    
18
  <li><a href="topic:views/display">Displays</a>, which control where the output will be seen. Every view has a default display, which doesn't actually display the view anywhere, but is used to hold the default settings for the view, and is used when the view is called programmatically if another display is not specified. Much more useful to users are the <a href="topic:views/display-page">page</a> display, which gives a view a path and allows it to be the primary content of a page, or the <a href="topic:views/display-block">block</a> display which allows it to appear as secondary content on other pages.</li>
19

    
20
<li><a href="topic:views/header">Header</a>, which allow you to add by default one or more text area above the views output. </li>
21

    
22
        <li><a href="topic:views/footer">Footer</a>, which allow you to add by default one or more text area beneath the views output. </li>
23

    
24
        <li>The <a href="topic:views/footer">Emtpy Text</a> content will be displayed, when you choose in the Arguments Section "Action to take if argument is not present" the option "Display empty text".</li>
25

    
26

    
27
</ul>
28

    
29
Parallels between the components in the Views interface and an sql query:
30

    
31
<table>
32
  <thead>
33
    <tr>
34
      <th>Sql Query</th>
35
      <th>Views Component</th>
36
    <tr>
37
  </thead>
38
  <tr>
39
    <td>SELECT n.title, u.name</td>
40
    <td>fields</td>
41
  </tr>
42
  <tr>
43
    <td>FROM {node} n  base table</td>
44
    <td>view type</td>
45
  </tr>
46
  <tr>
47
    <td>INNER JOIN {users} u ON n.uid = u.uid</td>
48
    <td>relationship</td>
49
  </tr>
50
  <tr>
51
    <td>WHERE n.status = 1</td>
52
    <td>filter</td>
53
  </tr>
54
  <tr>
55
    <td>AND u.uid = arg(1)</td>
56
    <td>argument</td>
57
  </tr>
58
  <tr>
59
    <td>ORDER BY n.changed DESC</td>
60
    <td>sort</td>
61
  </tr>
62
</table>