New Podcast

Posted Tuesday, July 27 at 2:29 pm

Ryan Price and Mike Anello recently talked with Jacob Redding (jredding), author of Beginning Drupal as well Treasurer and Interim General Manager of the Drupal Association.

Download Podcast 41
DrupalEasy_ep41_20100727.mp3
Syndicate content

NEWSLETTER

Stay informed on our latest news!

Syndicate content

Testimonial

Mike quickly spotted several flaws in our Drupal configuration and was able to teach us how to correct them. His training style and solid knowledge of Drupal makes for an efficient and productive training session. I came away with full confidence in the data I learned that day.

Who are we?

DrupalEasy is the collective expertise of Ryan Price and Michael Anello, who joined forces to provide training and consulting services worldwide. Read all about them and what they can do.

What is Drupal?

Drupal is a free, super-powerful content management system for sites that require information posting and collection, including blogs, forums, videos, photos, and databases of information. We think it is the best platform available. Here's why...

Why Drupal?

More and more savvy organizations are going with Drupal for content management, and its no mystery why. It’s free, flexible, and easy to maintain for small or large volume sites. Learn more...

Topic “views”

I need to change the number of items returned by a view, based on the theme!

A friend recently came to me with the following question:

I have a site that has a mode optimized for low-bandwidth use. Can I change the number of rows returned by a view based on the theme?

The Views 2 API has a function called hook_views_query_alter() which allows you to modify the View object before it pulls the results from the database.

In order to use views hooks, you must create a module that registers itself as using the Views API:
<?php
function drupaleasy_views_api() {
return array(
'api' => 2,

Update a View's Description

I was banging my head up against the wall trying to figure out how to update a view's description (normally set when you first create the view) and I put the question out to the twitterverse and @_happygolucky_ came to my rescue with this link that simply explains that the view description is hidden behind the "tag" link on the view editing page.

(how's that for a run-on sentence!)

Views Bulk Operations Main Admin Content Screen

One of the most actively used administration pages on any drupal site is the main content administration page (admin/content/node). From this page, the site administrator can quickly get a list of all the nodes on their site as well as filter and sort the list in a variety of ways.

However useful you may find this, you may not be aware that the Views Bulk Operations module provides an even more useful main content administration page with the often requested "search by title" filter.

Exposed Filters on Block Views

Exposed filters in Views are a wonderful thing. They allow your site visitors the ability to dynamically alter a view to suit their needs best. But what happens when you display your view in a block?

Exposed filters on View pages use URL querystring variables to pass the filter variables back to the server, but when your view is displayed in a block, this isn't possible.

Exporting Data to Microsoft Excel

Need to export data from your Drupal web site to Excel?

Use the Views Bonus Pack module - it gives you the ability to set your view's style to CSV, XML, DOC, and other formats.

Check it out!

Showcase a User's Comments with Views and Menu Tabs

By now, you should know and love the Tracker module that comes with core. It has its strengths, but many weaknesses. For one, you can't separate out posts from comments, or sort the list in interesting ways. Views can help you make exactly the list you want, and place it in a tab on the user's profile exactly like the "Track" tab.

For this example, you'll be adding a list of comments. Creating the view is simple enough:

  1. Clone the default view comments_recent, and call it comments_by_user
  2. On the Page display, add a Relationship for Comment:User

Adding photos to an event page with Views Attach

There are often 17 ways to do any particular action with Drupal - here is #18 on the list of "How do I display related content on this node's page?" You'll be using the Views Attach module and a nodereference field.

In this example, you want to relate a photo to an event. Inside the photo's content type, create a nodereference field that is able to reference the event content type. When a user is adding a new photo, she will be able to choose the related event if applicable.

Searching By Title on Main Admin Content Page

One of the most requested features by content administrators is the ability to search by node title on the main content administration page (admin/content/node). Since this isn't a feature of Drupal core, some people have resorted to (gasp!) hacking core or writing custom modules to get it done.

Change the Default Calendar View to Something Other than "Month"

If you use the most excellent Calendar module, then you probably know that it defaults to a "Month" view. Here's the easy way to change the default view to something different.

In your calendar's main view, click on the "defaults" tab, and then click to edit the "Date: Date (node)" argument. Simply change the "granularity" setting to whatever you want the default view to be and you're golden.

(I found this tip deep in the Drupal.org forums.)

Can't set Page Title inside hook_preprocess_page? Hack it!

If your client is being very picky about the titles of certain pages, especially views, you may find yourself needing to write some code to set the title at the theme level. This is normally fine, since Drupal 6 has some great hooks, like hook_preprocess_page() and its cousins for blocks, nodes, and user profiles.

Syndicate content