Drupal 7

494 3.2K 0
Drupal 7

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

SECOND EDITION Using Drupal Angela Byron, Addison Berry, and Bruno De Bondt Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo Using Drupal, Second Edition by Angela Byron, Addison Berry, and Bruno De Bondt Copyright © 2012 Angela Byron, Addison Berry, and O’Reilly Media, Inc All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com. Editors: Julie Steele and Meghan Blanchette Production Editor: Kristen Borg Proofreader: Rachel Monaghan Indexer: John Bickelhaupt Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano December 2008: First Edition. April 2012: Second Edition. Revision History for the First Edition: 2012-04-09 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449390525 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Using Drupal, the image of a dormouse, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-39052-5 [LSI] 1334005156 Table of Contents Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii 1. Drupal Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 What Is Drupal? 1 Who Uses It? 2 What Features Does Drupal Offer? 3 A Brief History of Content Management 4 A Historical Look at Website Creation 4 The Age of Scripts and Databases 6 The Content Revolution 7 How Does Drupal Work? 8 Modules 9 Users 10 Content (Nodes) 11 Entities and Fields 12 Ways of Organizing Content 13 Types of Supporting Content 15 Getting Help 15 Conclusion 17 2. Drupal Jumpstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Case Study 20 Implementation Notes 21 Spotlight: Drupal’s Administration Interface 22 Hands-On: Changing Administrative Settings 25 Spotlight: Content Management 26 Content 26 Comments 30 Navigation 32 iii Blocks 34 Hands-On: Content Management 36 Creating a Basic Page 36 Creating an Article 39 Managing Site Navigation 40 Configuring Blocks 42 Spotlight: Modules 44 Module Administration Page 45 Finding and Installing Modules 46 Removing Modules 48 Hands-On: Working with Modules 49 Spotlight: Access Control 53 Configuring User Access 54 User Profiles 57 Account Settings 58 Handling Abusive Users 58 Hands-On: Creating Roles and Users 59 Hands-On: Configuring Permissions 62 Spotlight: Content Moderation Tools 66 Automated Spam Detection 66 Manual Spam Prevention Tools 68 Hands-On: Contact Form 68 Spotlight: Themes 71 Finding a Theme 72 Theme Installation 73 Theme Configuration 73 Blocks and Regions 75 Administration Theme Setting 76 Hands-On: Branding the Site 77 Summary 79 3. Job Posting Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Case Study 82 Implementation Notes 83 Spotlight: Field and Field UI 83 Field Types 85 Input Widgets 86 Displays, View Modes, and Formatters 87 Reusing Existing Fields 90 Hands-On: Job Content Type 92 Spotlight: References 100 Hands-On: Adding a Reference Field 100 Hands-On: Customizing Field Display 102 iv | Table of Contents Hands-On: Job Application Type 108 Spotlight: Views Module 113 Data Types 115 Displays 118 Pieces of a View 121 Hands-On: The Views Module 124 Jobs View 125 Applications View 134 Taking It Further 146 Summary 147 4. Media Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Case Study 150 Implementation Notes 151 Spotlight: Image Styles 152 Styles and Effects 153 Using an Image Style 157 Troubleshooting Image Styles 158 Hands-On: Image Styles 159 Create Image Styles 160 Improve Image Quality 163 Spotlight: Media 164 Media Files 165 Media Browser 166 Hands-On: Music Reviews 168 Review Content Type 168 Displaying Media Files 173 Spotlight: Content Editing and Image Handling 177 Content Editing 178 Integrating Media in Content 179 Spotlight: Text Formats and Filters 179 Hands-On: Setting Up WYSIWYG 183 Set Up and Configuration 183 Enabling the Media Filter 189 Spotlight: Media Internet Sources 189 Hands-On: Posting Videos 191 Taking It Further 192 Summary 193 5. Product Reviews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Case Study 196 Implementation Notes 197 Hands-On: Basic Product Reviews 199 Table of Contents | v Creating the Product Review Content Type 199 Spotlight: Amazon Module 203 What’s Included? 203 Locale 204 Referral Settings 204 Amazon Keys 204 Hands-On: Adding an Amazon Field 204 Adding the Product Field 206 Spotlight: Voting API and Fivestar 209 Hands-On: Adding Ratings 210 Adding the Product Rating Field 210 Adding the Reader Rating Field 211 Spotlight: CSS Injector 212 Hands-On: Polishing the Presentation 213 Setting Field Display Options 214 Configuring CSS Injector 216 Hands-On: Building a Product List 217 Spotlight: The Search Module 222 Searching with Views 223 Hands-On: Make the Product List Searchable 224 Rewriting Views Field Output 226 Taking It Further 228 Summary 228 6. Event Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Case Study 232 Implementation Notes 232 Hands-On: First Steps 233 Creating an Event Content Type 233 Access Control 234 Spotlight: Date Module 235 Date Submodules 235 Date Field Types 236 Date Form Elements 236 Date Field Settings 239 Hands-On: Adding Dates 242 Add the Date Field 242 Hands-On: Upcoming Events View 245 Spotlight: Calendar Module 248 Calendar View Type 248 iCal Integration 250 Hands-On: Calendar View 250 Spotlight: Flag Module 252 vi | Table of Contents Flag Settings 254 Flag Actions Module 257 Hands-On: Flag Configuration 257 Hands-On: Attendee View 259 Taking It Further 261 Summary 262 7. Managing Publishing Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Case Study 264 Implementation Notes 265 Spotlight: Taxonomy 266 Vocabularies and Terms 267 Taxonomy Term Links 268 Hands-On: Categorizing Content 269 Spotlight: Pathauto 273 Path Aliases 273 Pathauto Patterns 274 Hands-On: Automating URL Aliases 276 Spotlight: Workbench 278 My Workbench 279 Hands-On: Creating Editorial Work Spaces 280 Hands-On: Generating Sample Content 281 Spotlight: Workbench Access 284 Using Hierarchies to Define Access Control 284 Assigning Editorial Access to Workbench Access Sections 286 Hands-On: Workbench Access 287 Setting Up Access Control with Workbench Access 290 Spotlight: Workbench Moderation 295 Editorial Workflow Management with Workbench Moderation 295 Hands-On: Workbench Moderation 298 Taking It Further 304 Summary 304 8. Multilingual Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Case Study 308 Implementation Notes 309 Spotlight: Interface Translation 310 Locale 311 Hands-On: Installing a Translation 316 Hands-On: Configuring Locale Features 318 Language Detection and Selection 318 Language Switcher 319 Spotlight: Localization Client 320 Table of Contents | vii Hands-On: Translating the Interface 321 Using the Locale Module 321 Using the Localization Client 323 Spotlight: Content Translation 326 Hands-On: Translating Content 328 Multilingual Content 328 Translation 329 Spotlight: Internationalization 332 Multilingual Content Selection 333 Strings 333 Site-Wide Language-Dependent Variables 333 Module Helpers 334 Paths 335 Synchronization 335 Hands-On: Internationalization Features 336 Content Selection 336 Site-Wide Variables 336 Content Types 339 Taxonomy 342 Menu Translation 345 Taking It Further 345 Summary 346 9. Online Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 Case Study 350 Implementation Notes 351 Spotlight: Drupal Commerce 351 Commerce and Commerce UI 352 Cart 352 Checkout 353 Customer and Customer UI 353 Order, Order UI, Line Item, and Line Item UI 355 Payment and Payment UI 355 Product and Product UI 356 Product Reference 357 Price, Product Pricing, and Product Pricing UI 357 Tax and Tax UI 357 Additional Drupal Commerce Add-Ons 357 Spotlight: Managing Products with Drupal Commerce 358 Products and Product Types 358 Hands-On: Products and Product Types 359 Initial Setup Tasks 359 Configuring Product Types 359 viii | Table of Contents [...]... Further Summary 362 364 366 366 368 370 371 373 374 383 385 388 389 393 394 395 396 3 97 400 402 403 A Installing and Upgrading Drupal 405 B Choosing the Right Modules 425 C Modules and Themes Used in This Book 441 D Major Changes Between Drupal 6 and 7 ... stories Additionally, Dries Buytaert, the Drupal project founder and project lead, maintains a list of several high-profile Drupal websites on his blog at http://buytaert.net/tag /drupal- sites 2 | Chapter 1: Drupal Overview Figure 1-1 The Drupal Showcase highlights high-profile sites in multiple industries, categories, and countries What Features Does Drupal Offer? Drupal provides a number of features,... “required reading” if you haven’t used Drupal before The rest of the chapters will assume knowledge of these chapters, including the basics of Drupal and the Views and Field modules If you’re familiar with Drupal 6 but haven’t yet used Drupal 7, you may also want to skim these chapters, as the user interface and feature set has changed significantly between versions Chapter 1, Drupal Overview This chapter answers... your programs and documentation All Drupal code, including the Drupal 7 code that you can access through the O’Reilly website (as described shortly) is subject to the GNU General Public License, version 2 Your use of Drupal code, including copying, modification, and distribution, is subject to the license Drupal is a registered trademark of the founder of the Drupal project, Dries Buytaert Information... publisher: O’Reilly Media, Inc 1005 Gravenstein Highway North Sebastopol, CA 95 472 800-998-9938 (in the United States or Canada) 70 7-829-0515 (international or local) 70 7-829-0104 (fax) We have a web page for this book, where we list errata, examples, and any additional information You can access this page at: http://oreil.ly/using -drupal- 2e To comment or ask technical questions about this book, send email... the functionality that we’ll be discussing in this book is built using a combination of “core” Drupal and these community-created “contrib” modules And we would be remiss not to also acknowledge Drupal s community; the wetware element of Drupal is often cited as one of Drupal s biggest assets When Drupal 7 was released in January 2011, nearly 1,000 members of the community contributed code to the core... Apache/MySQL/PHP packages available such as WAMP for Windows or MAMP for Macs Visit http:/ /drupal. org/hosting for a list of Drupal- friendly web hosting companies (with referrals benefiting the Drupal Association), and visit http:/ /drupal. org/requirements to read more about Drupal s system requirements You will also need to install Drupal, and the hands-on chapters assume that you’re using the book’s source code... websites this way And finally, we’ll define and explain the core Drupal concepts that are necessary to understand how Drupal handles its content What Is Drupal? Drupal is an open source1 content management system (CMS) being used by hundreds of thousands of organizations and individuals to build engaging, content-rich websites Building a website in Drupal is a matter of combining together various “building... “need to know” questions about Drupal: what’s Drupal, who’s using it, why are they using it, and how does it conceptually work? It also provides some historical context to Drupal, introduces essential terminology, and covers everything else you need to get up to speed Chapter 2, Drupal Jumpstart The first hands-on chapter hits the ground running, and will show you how to use Drupal s core functionality,... government’s open data portal, are also using Drupal to provide more transparency and better connect with their citizens What these websites have in common is a need for powerful publishing options and rich community features The Drupal Showcase website, shown in Figure 1-1, highlights some of these and other high-profile Drupal websites Drupal s own website also has a Drupal case studies section containing

Ngày đăng: 07/04/2014, 11:45

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Foreword

  • Preface

    • Audience

    • Assumptions This Book Makes

    • A Note About the Modules Used in This Book

    • Contents of This Book

    • Conventions Used in This Book

    • Using Code Examples

    • Downloading the Book’s Source Code

    • Safari® Books Online

    • How to Contact Us

    • Acknowledgments

    • Chapter 1. Drupal Overview

      • What Is Drupal?

        • Who Uses It?

        • What Features Does Drupal Offer?

        • A Brief History of Content Management

          • A Historical Look at Website Creation

          • The Age of Scripts and Databases

          • The Content Revolution

          • How Does Drupal Work?

            • Modules

            • Users

            • Content (Nodes)

Tài liệu cùng người dùng

Tài liệu liên quan