You are previewing Drupal 7 Cookbook.

Drupal 7 Cookbook

Cover of Drupal 7 Cookbook by Dylan James Published by Packt Publishing
  1. Drupal 7 Cookbook
    1. Drupal 7 Cookbook
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
    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
    7. 1. Installing and Configuring Drupal
      1. Introduction
      2. Installing Drupal
      3. Installing Drupal distributions
      4. Installing modules and themes
      5. Setting up site search
      6. Creating a multi-site Drupal installation
    8. 2. Creating and Publishing Content
      1. Introduction
      2. Creating a basic page and adding it to the main menu
      3. Installing and configuring a WYSIWYG editor
      4. Editing existing content and adding an image
      5. Adjusting the tabbed settings for content nodes
      6. Configuring comments
      7. Publishing an RSS feed of basic pages
    9. 3. Working with Blocks
      1. Introduction
      2. Adding a new block
      3. Creating a submenu block
      4. Creating a Superfish menu block
      5. Creating a block with Views
      6. Adding a new block region to a theme
      7. Creating a mega-footer menu
      8. Conditional display of a block
    10. 4. Custom Content Types
      1. Introduction
      2. Creating a basic content type
      3. Configuring the output of a content type
      4. Applying an image format
      5. Installing more field types
      6. Creating a more advanced content type
      7. Building a custom content importer
      8. Building a forum
    11. 5. Using Views to Create Custom Lists, Grids, and Tables
      1. Introduction
      2. Creating a news listing view
      3. Creating a dynamic view
      4. Creating a latest news block
      5. Creating a news image grid view
      6. Creating a randomly selected list of images
      7. Creating an archived content block and view
      8. Building complex views using relationships
      9. Adding a text search filter to a view
      10. Using attachments to extend Views' output
    12. 6. Creating Flexible Pages Using Panels
      1. Introduction
      2. Adding custom text to a page
      3. Adding a block to a page
      4. Adding a dynamic view to a page
      5. Configuring the visibility of the page
      6. Creating a custom page layout using the Layout builder
    13. 7. Working with Media
      1. Introduction
      2. Creating a simple slideshow carousel
      3. Creating a document content type
      4. Creating a simple document library
      5. Linking documents to a content type
      6. Adding video to a content type
    14. 8. Integrating Web APIs
      1. Introduction
      2. Integrating with Facebook
      3. Displaying a live Twitter feed
      4. Adding simple PayPal integration to content types
      5. Setting up the Add this social bookmarking service
      6. Adding a Google Map to content
    15. 9. Creating Regular, Mobile, and Tablet Themes
      1. Introduction
      2. Creating a new theme using Zen
      3. Overriding HTML output of a content type
      4. Creating a "bare-bones" theme from scratch
      5. Using the Mobile tools module
      6. Installing an off-the-shelf mobile and tablet theme
      7. Configuring theme compression and caching
    16. 10. Working with Other Languages
      1. Introduction
      2. Installing another language using Locale
      3. Managing interface translation using Locale
      4. Enabling content type translation
      5. Displaying a language switching block for end users
      6. Creating a multilingual View
    17. 11. Managing Users
      1. Introduction
      2. Creating new user accounts
      3. Managing user roles
      4. Setting up a new user notification
      5. Adding a biography field to the user profile
      6. Building a grid view of profile pictures
    18. 12. Running Drupal
      1. Introduction
      2. System maintenance
      3. Setting up a backup system
      4. Search Engine Optimization (SEO) with Drupal
      5. Securing a Drupal installation
      6. Configuring Drupal caching
      7. Running commands with the Drush tool
O'Reilly logo

Creating a dynamic view

In the previous recipe we saw how to create a view with a static filter applied to it. In this recipe we will be creating a view where the filter can be dynamically set by the calling URL, which contains the arguments. We will also be setting up a view which is generated from a URL in the following format:

http://www.example.com/news/8

This URL contains the argument "8", which will be used to filter the view to display only news stories from category 8, as in the following screenshot:

Creating a dynamic view

This technique can help to increase the flexibility of your view and to dramatically reduce the build time of your site when you are using ...

The best content for your career. Discover unlimited learning on demand for around $1/day.