You are previewing Drupal 7 Themes.
O'Reilly logo
Drupal 7 Themes

Book Description

Give your Drupal websites an exciting, user-friendly new look using themes. From installing new themes, to customizing them, to building them from scratch, here is the complete guide you’ve been looking for.

  • Learn to create new Drupal 7 themes

  • No experience of Drupal theming required

  • Discover techniques and tools for creating and modifying themes

  • The first book to guide you through the new elements and themes available in Drupal 7

  • In Detail

    Drupal is an award winning open source Content Management System (CMS). Based on PHP and MySQL, its power and flexibility combined with its exceptional design mean it is one of the most popular choices for creating a CMS website.

    Drupal employs a specialized templating system and supports themes, which allow you to change the look and feel of your system's front and back-end interfaces.

    Drupal 7 Themes is an ideal introduction to theming with Drupal 7. If you want to create a striking new look for your Drupal 7 website, this book is for you. This book is a revised, updated and expanded edition of Drupal 6 Themes, rewritten specifically for Drupal 7.

    This book will show you techniques and tools to help you improve the look and feel of any Drupal 7-powered website. Starting from the basics of theme setup and configuration, you will learn about the Drupal theming architecture and the PHPTemplate engine, and then move on to modifying existing themes and building new themes from scratch. You will find out about tools to make your theme development easier.

    A practical guide showing you how to create themes for your Drupal 7 site

    Table of Contents

    1. Drupal 7 Themes
      1. Drupal 7 Themes
      2. Credits
      3. About the Author
      4. About the Reviewer
      5. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      7. 1. Learning the Basics of Drupal Theming
        1. The importance of themes in Drupal
          1. One template or many? It's up to you
          2. Get creative with configuration
          3. Intercept and override
          4. Sub-themes are your friends
        2. What is a theme?
          1. Official Drupal online resources
        3. What is a theme engine?
        4. The range and flexibility of Drupal themes
        5. The output of a Drupal theme
        6. The site administrator's view
        7. The default Drupal themes
          1. Bartik
          2. Garland
          3. Stark
        8. Theme files
        9. Summary
      8. 2. Working with the Default Configuration and Display Options
        1. Configuring a theme
          1. Global Theme Configuration
            1. Toggle Display
            2. Logo Image Settings
            3. Shortcut Icon Settings
          2. Theme-Specific Configuration
        2. Controlling module and block visibility
          1. Introducing the Module Manager
          2. Introducing the Blocks Manager
          3. Configuring individual blocks
            1. Region Settings
            2. Visibility Settings
              1. Pages
              2. Content Types
              3. Roles
              4. Users
        3. Finding additional themes
        4. Installing an additional theme
          1. Automatic installation
          2. Manual installation
        5. Uninstalling themes
        6. Summary
      9. 3. Understanding PHPTemplate Themes
        1. What is PHPTemplate?
        2. How does it all work?
        3. Key PHPTemplate theme files
          1. The role of the .info file
          2. The role of the page.tpl.php file
          3. Two contrasting examples
            1. A simple PHPTemplate theme–Seven
            2. A more complex PHPTemplate theme–Bartik
              1. Alternative theme engines
                1. PHPTAL
                2. Smarty
        4. Summary
      10. 4. Using Intercepts and Overrides
        1. Putting together the pieces
          1. Default templates
          2. Default stylesheets
          3. The themable functions
        2. Overriding the default CSS
          1. CSS overrides in action
          2. Overriding core stylesheets
        3. Overriding templates and themable functions
          1. Various approaches to overriding the Default Styling
            1. Overriding templates
            2. Overriding functions
            3. Converting themable functions into dedicated templates
          2. Overrides in Action: A look at overrides in Bartik
            1. Overriding the default template files
            2. Overriding themable functions
        4. Working with template variables
          1. Intercepting and overriding variables
          2. Making new variables available
        5. Summary
      11. 5. Customizing an Existing Theme
        1. Setting up the workspace
        2. Planning the modifications
        3. Selecting a base theme
        4. Creating a new sub-theme
          1. Create a copy of the base theme
          2. Create the sub-theme in a new directory
          3. Delete the files you don't need
          4. Update the theme name throughout the sub-theme
          5. Create a stylesheet for your sub-theme
          6. Update the sub-theme's .info file
        5. Customizing the sub-theme
          1. Configuring the theme
          2. Adapting the CSS
            1. Modifying a default template
            2. Overriding a themable function
        6. Summary
      12. 6. Creating a New Theme
        1. Planning the build
        2. Creating a new theme through sub-theming
          1. Selecting a base theme
          2. Creating the sub-theme
          3. Configuring the site
          4. Styling the new theme
            1. Fusion's theming resources
            2. Customizing the styling
              1. Working with the CSS
              2. Modifying the templates
              3. Working with the template.php file
        3. Building a new theme without sub-theming
          1. Planning the build
          2. Creating the necessary elements
            1. Populating the .info file
            2. Customizing the page.tpl.php file
            3. The style.css file
            4. Adding optional elements
          3. Packaging your theme
        4. Summary
      13. 7. Dynamic Theming
        1. Designating a separate Admin theme
        2. Using multiple page templates
          1. Creating a unique home page template
          2. Using a different template for a group of pages
          3. Assigning a specific template to a specific page
          4. Designating a specific template for a specific user
        3. Dynamically theming page elements
          1. Associating elements with the front page
          2. Styling by region
          3. Dynamically styling blocks
        4. Creating dynamic CSS styling
          1. Employing $classes for conditional styling
          2. Adding new variables to $classes
          3. Creating dynamic selectors for nodes
          4. Creating browser-specific stylesheets
        5. Summary
      14. 8. Dealing with Forms
        1. The Default Forms
          1. The User Forms
            1. Login Form
              1. Login Block Form
              2. Login Page Form
            2. User Registration Form
            3. Request Password Form
            4. User Profile Editing Form
          2. Contact Form
          3. Search Forms
            1. Block Search Form
            2. Page Search Form
            3. Advanced Search Form
            4. Search results page
          4. Poll module Forms
            1. Poll Block Form
            2. Poll Page Form
          5. Comment Form
          6. Administration Forms
        2. How Forms work in Drupal
        3. Modifying forms
          1. Working with the CSS styling
          2. Modifying the page or block holding the form
            1. Overriding the templates for pages and nodes containing forms
            2. Overriding the templates for blocks containing forms
          3. Overriding the default form templates
          4. Overriding theme functions to control form elements
          5. Creating dedicated templates for forms
          6. Modifying forms with custom modules
        4. Summary
      15. 9. Overcoming Common Challenges in Drupal Theming
        1. Maintaining cross-browser compatibility
        2. Creating accessible themes
          1. Validation tools
          2. Drupal theme accessibility basics
            1. Avoiding tables
            2. Creating accessible forms
            3. Not relying on JavaScript
            4. Making sure your text resizes
            5. Ordering elements on the screen logically
            6. Providing hover states and visited states
            7. Providing alternatives to applets and plugins
            8. Supporting a semantic structure
            9. Using system fonts for your menus
            10. Using capitalization appropriately
            11. Using a suitable color scheme
            12. Using jump links
        3. Creating template suggestions for fields
        4. Creating template suggestions for specific nodes
        5. Suggestions for key modules
          1. Styling the Comment module
          2. Styling the Forum module
          3. Styling the Poll module
          4. Styling the Profile module
          5. Styling the Search module
        6. Theming Views
        7. Theming Panels
        8. Theming the maintenance page
        9. Troubleshooting your theme
          1. Basic principles
          2. Troubleshooting common problems
        10. Summary
      16. 10. Useful Extensions for Themers
        1. Drupal modules
          1. Administration Menu
          2. Chaos Tool Suite
          3. Colorbox
          4. Conditional Stylesheets
          5. Devel
          6. @font-your-face
          7. Frontpage
          8. HTML5 Tools
          9. .mobi Loader
          10. Mobile Theme
          11. Nice Menus
          12. Noggin
          13. Organic Groups
          14. Panels
          15. Semantic Views
          16. Skinr
          17. Style Guide
          18. Sweaver
          19. Taxonomy Theme
          20. ThemeKey
          21. Views
          22. Webform
        2. Third-party software
          1. Drush
          2. Firebug
          3. Web Developer Extension
          4. YSlow
        3. Summary
      17. A. Identifying Templates, Stylesheets, and Themable Functions
        1. A guide to Theming Elements
          1. Common Theme System functions
          2. Theming the Aggregator module
            1. Default templates
              1. aggregator-feed-source.tpl.php
              2. aggregator-item.tpl.php
              3. aggregator-summary-item.tpl.php
              4. aggregator-summary-items.tpl.php
              5. aggregator-wrapper.tpl.php
            2. Default stylesheets
            3. Themable functions
          3. Theming the Block module
            1. Default templates
              1. block.tpl.php
              2. block-admin-display-form.tpl.php
            2. Default stylesheets
          4. Theming the Book functionality
            1. Default templates
              1. book-all-books-block.tpl.php
              2. book-export-html.tpl.php
              3. book-navigation.tpl.php
              4. book-node-export-html.tpl.php
            2. Default stylesheets
            3. Themable functions
          5. Theming the Color module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          6. Theming the Comment functionality
            1. Default templates
              1. comment-wrapper.tpl.php
              2. comment.tpl.php
            2. Default stylesheets
            3. Themable functions
          7. Theming the Dashboard module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          8. Theming the DBLog module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          9. Theming the Field module
            1. Default templates
              1. field.tpl.php
            2. Default stylesheets
            3. Themable functions
          10. Theming the Field UI module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          11. Theming the File module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          12. Theming the Filter module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          13. Theming the Form functionality
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          14. Theming the Forum module
            1. Default templates
              1. forum-icon.tpl.php
              2. forum-list.tpl.php
              3. forum-submitted.tpl.php
              4. forum-topic-list.tpl.php
              5. forums.tpl.php
            2. Default stylesheets
            3. Themable functions
          15. Theming the Help module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          16. Theming the Image functionality
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          17. Theming the Locale functionality
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          18. Theming the Menu functionality
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          19. Theming the Node functionality
            1. Default templates
              1. node.tpl.php
            2. Default stylesheets
            3. Themable functions
          20. Theming the OpenID module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          21. Theming the Overlay module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          22. Theming the Poll module
            1. Default templates
              1. poll-bar--block.tpl.php
              2. poll-bar.tpl.php
              3. poll-results.tpl.php
              4. poll-results--block.tpl.php
              5. poll-vote.tpl.php
            2. Default stylesheets
            3. Themable functions
          23. Theming the Profile module
            1. Default templates
              1. profile-block.tpl.php
              2. profile-listing.tpl.php
              3. profile-wrapper.tpl.php
            2. Default stylesheets
            3. Themable functions
          24. Theming the Search module
            1. Default templates
              1. search-block-form.tpl.php
              2. search-result.tpl.php
              3. search-results.tpl.php
            2. Default stylesheets
            3. Themable functions
          25. Theming the Shortcut module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          26. Theming the System module
            1. Default templates
              1. html.tpl.php
              2. maintenance-page.tpl.php
              3. page.tpl.php
              4. region.tpl.php
            2. Default stylesheets
            3. Themable functions
          27. Theming the Taxonomy module
            1. Default Template
              1. taxonomy-term.tpl.php
            2. Default stylesheets
            3. Themable functions
          28. Theming the Toolbar module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          29. Theming the Tracker module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          30. Theming the Update module
            1. Default templates
            2. Default stylesheets
            3. Themable functions
          31. Theming the User module
            1. Default templates
              1. user-picture.tpl.php
              2. user-profile-category.tpl.php
              3. user-profile-item.tpl.php
              4. user-profile.tpl.php
            2. Default stylesheets
            3. Themable functions