Book Image

Drupal 6 Attachment Views

By : J. Ayen Green
Book Image

Drupal 6 Attachment Views

By: J. Ayen Green

Overview of this book

<p>The Drupal View modules give you the flexibility and freedom to customize the display of your web site's content. Defining custom content types is easy; however, it's also possible to use various content types in a complementary manner on the same page! Attachment displays in Views (also known as Attachment Views), are a way to customize your web site with multiple displays that interact with each other and turn a nice site into a spectacular one.<br /><br />This hands-on tutorial will teach Drupal developers across the experience spectrum how to use Attachment displays in Views, to make quick progress in functionality and added-value to users! Views are a common way to display a collection of similar content types on one page. What do you do if you want to display different content types simultaneously? What if you want to allow a user to interactively select which content they want, without using a menu? You can actually have more than one display within a view and views within a view.<br /><br />This book starts by introducing Attachment Views as reader activities. Here, we create a single Attachment View and take a closer look at giving each page an interactive feel. It also shows you to create a View with an Attachment View. Later, using practical examples, it helps you to develop a 3-view composite display using two and three custom content types. You will also be able to develop a composite display using multiple Attachment Views, to provide a control panel of sorts from which you can view the various content types. Finally, we will put the home page together making use of Views, blocks, a flash slide show, and other pieces.<br /><br />This book provides several examples of introducing additional displays onto a web page, and having them interact with each other. The result is pages that provide several types of information and behave more like a desktop application, increasing the value to your site visitors.</p>
Table of Contents (17 chapters)
Drupal 6 Attachment Views
Credits
About the Author
About the Reviewers
Preface

Appendix B. Custom Content Types

We have used several content types in our site. Introductory information regarding the creation of a content type is presented here, followed by information about each content type that was created for this site.

CCK

Drupal is a Content Management System. As such, it is content-centric. That is, instead of being business-function centric, where various tables in a database holding business-function data are gathered together dynamically to form a piece of content, in Drupal the focus is the content.

Following a new install of D6 (Drupal version 6.x), Drupal contains two content types; Story and Page. However, there is a menu choice (admin/content/types) to create a new content type. So, for example, if you are reviewing books on your site, you might want a book to be a content type unto itself. You can create a content type and name it book, but there is very little you can do, initially, to make your new content type look any different from the other two.

Enter the CCK module. CCK (see more information in Appendix A) is a module originally written by Yves Chedemois (yched at drupal.org). It offers so much functionality that there are web pages, web instructions, training courses, and books just on this topic. In a nutshell, CCK gives you the ability to add fields to your content types via a simple user interface, and once added, these fields are available throughout most of Drupal, and especially, given our context, within Views.

Adding fields to a content type is as simple as giving the field a name, choosing the field type, and adding it. Field types are provided through submodules and other add-on modules, and include text fields, select lists, checkboxes, radio buttons, dates, files, and images. You can provide option lists for select lists, default values for text fields, and other configuration data. You can even define field sets, and whether a field set is viewable initially, and whether it's collapsible. The best part is that, once you have defined the fields for a content type, they appear automatically on the node create form for that content type.