Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Drupal 5 Views Recipes

You're reading from   Drupal 5 Views Recipes 94 recipes to develop custom content displays for your Drupal web site

Arrow left icon
Product type Paperback
Published in May 2009
Publisher Packt
ISBN-13 9781847196965
Length 412 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Toc

Table of Contents (22) Chapters Close

Drupal 5 Views Recipes
Credits
About the Author
Acknowledgement
About the Reviewer
Preface
1. Introduction to Views FREE CHAPTER 2. Working with Default Views 3. CCK and Views 4. Dates and Calendars 5. Views and Tools for Administrators 6. Views Galore 7. Theming and Layout 8. Navigating the Online Drupal Community Default Views in Drupal 5 Modules
Formatters
Style Plugins
Views Hooks for Coders
Modules Included in Recipe Ingredients
Additional Resources and Modules Mentioned in Recipes
Selected Noteworthy Patches to Views
Index

Recipe 81: Grouped View


Note

Ingredients

Completed Recipe 79, or thorough read-through

Completed Recipe 80, to at least Step 3

Computed field module: http://drupal.org/project/computed_field

Regenerate module: http://drupal.org/node/195013#comment-854212

Devel module: http://drupal.org/project/devel

The Theme wizard, which we used in Recipe 79 for a Simple List view, also offers a Grouped List view. We'll group items in a view by month.

The most convenient method for grouping with the Theme wizard is to simply store a new variable in the database, containing the group name. We'll use the Computed Field module to achieve this.

  1. Complete Recipe 80, up to at least Step 3.

  2. Install and enable the Computed Field module.

  3. Click on Add field at admin/content/types/event/fields. Name the field Month, and select the Computed field. Click on the Create field button.

  4. Enter the following into the Computed Code area:

    $node_field[0]['value'] = format_date($node->field_event_date[0]['value'], 'custom', "F");

    You will...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image