Drupal 6

Importing Content Using The Feeds Module

This lesson shows how to automatically import content from RSS or Atom feeds with the help of the Feeds module. The process relies on cron to run periodically so that the feed processor can check for new content. The feed processor creates regular Drupal nodes from the items contained in the feed. You can choose to have the imported items published by default or not. Once the items have been imported as nodes you can then create custom paths to those using Pathauto and/or customize the display using the Views module.

Note: Click the 'full screen' icon (to the right of the volume control) in order to watch online at full 1280x720 resolution.

Bookmark and Share Bookmark or Share Post

Moving Beyond Nodes

If you're like most people who build using Drupal you want to build your site around nodes, that have titles, descriptions, tags, comments, etc. It's no surprise since those types of content oriented sites are the ones that make the world of the web go round. But what about another type of site that focuses not on nodes but on data contained in the Drupal database? Can you do it? Yes. Should you do it? Only if that sort of thing excites you or perhaps if a client requests it.

I'll give you a little background on where I'm coming from and what made me decide to play around with Drupal as a way to expose data sets. About a decade ago I was part of a group of people who built a first of its kind application to send and receive data from wholesale power markets in North America. The application was built on three tiers: a client, an application server, and a database server. The client and application server were written in Java and the database relied on Oracle technology. It was about as far away from open source as you could get. The product was successful though and we did hundreds of installs all across North America. What the product basically did for its owners was suck in data from a central server then expose that data to the user via tables and charts visible from the user interface. At some point last year I started wondering if I could do something similar with Drupal. So I started investigating, tried out different modules and realized that I could do even more with a Drupal install than we did with that product.

There are four tasks that need to be accomplished if you want to use Drupal as an effective data platform.

  1. Capture data to the Drupal database tables
  2. Setting the data types (text, numeric, etc.)
  3. Expose the data to the user using tables and charts
  4. Offer simplified download format options

 Capturing Data

I have been capturing data using the Table Wizard module. Table Wizard allows you to create a database table by uploading a delimited (like tab or comma separated) file. This works pretty well. I recently uploaded a file with over 300,000 records and it was in the database within a few minutes. After you upload your file you click on the table name to "analyze" the table. Table Wizard will let you know what columns you have in the table, the data types and identify the primary key. When you first upload your data you will want to go switch over to your database to change data types of the appropriate ones and identify a primary key. Once you have done that you can come back and re-analyze the table. 

Setting the Data Types

This is probably the step that will be the least welcome to those who are not familiar with databases. If you want to do extensive work with data in Drupal then you will want to become familiar enough with phpMyAdmin and MySQL data types to be able to navigate to your database and apply the appropriate settings for each type of data. You should also indicate which field contains the primary key for the table. The primary key is a unique value that identifies each record in a table. If you have a dataset that does not have a column with unique values then consider adding a column unique numeric code in each row. You can name the column something like record_id and then add values like 100001, 100002, 100003 and so on.

Expose the Data Using Tables and Charts

If you have been a good boy or girl and added a single field primary key then the Table Wizard module will let you check a box that is labeled, "Provide default view." This option automatically creates a view that you can expand upon as you see fit. Auto created table wizard views will have the tag "tw" added to them. You can also create a view by navigating to /build/views/add and looking for the radio button in the 'View Type' section that starts with Database table. At this point you need to a thing or two about the Views module to go further. There's not enough space to cover that here so I'm going to skip over the details and point you to the key modules and settings.

The standard views module will let you create a table from your data. You just have to choose a Page display and choose the Table style. You can then choose your fields which will appear as columns within the table. Give the page a Path and perhaps add an Exposed Filter or two to allow users to narrow down the data they are looking at. If you want to get a little fancy you can choose use Views Calc to create tables that include calculations like min, max or average on a set of numeric data.

Charts are a little more tricky but it can be done with the assistance of Charts and Graphs and Views Charts. Charts and Graphs allows you to integrate a number of different free charting solutions (including Google Charts) into your site. View Charts makes those features available as a Style (called "Charts") within the Views interface. The chart gets exposed on a page based on the Path that you define. You can also create a chart within the Block display type. There are other charting modules that exist for Drupal. All of them have some drawbacks but so far the Charts and Graphs/Views Charts combo has worked the best for me.

Offering A Download Option

The ability to download data probably won't be a must have feature for every site. After all someone could probably just copy the table and paste it into their favorite spreadsheet program. It's a nice feature to offer though and you can do it pretty easily with the help of the Views Bonus Pack module. With Views Bonus Pack installed you get the option to add a Feed display within the Views interface. With the Feed display selected you then get the option of setting a Style that includes the option for CSV and other popular formats like TXT, DOC, XLS and XML. You can then attach that display to the Table display and there will be an image that appears at the bottom of the table page that will generate a file download when clicked. Be sure to add the same filters to the CSV display that you have added to the Table display so the downloaded file reflects what the user is seeing with any filters selected. 

The usual caveats apply to the ideas and tips that I've offered here. At any time a better module could come along or an existing module could change and alter the process a bit. So tread lightly and do some exploration before you commit to building a data driven site using Drupal. In fact, even though there was a very recent release of Table Wizard the development is being deprecated in favor of the Data module. I'll continue to upload using Table Wizard for now since I think it works well but also plan on giving the Data module a shot in the near future. 

As always I'd love to hear your thoughts and tips on modules and workflows in the comments. If you have built or know of a good data access website built using Drupal feel free to share those links as well.

Bookmark and Share Bookmark or Share Post

Managing A Drupal Site On The iPad

For the past couple of months I've had my hands on an Apple iPad and one of the first things I was interested in trying out was how effectively I could manage my Drupal sites with the device. Since I didn't want to jump to hasty conclusions about how good or bad the experience is I've waited all this time to write about it. In general I'll say that it's not a bad experience. The larger screen makes managing your site much more realistic than on the iPhone which I think is nearly an impossible task because of the small screen size. With that said you won't want to sound much time engaging in hard core site building on the iPad either.

Here's what you can do. You can access any menu item even with the Administration Menu module that places a bar at the top of the screen. The drop down menus work fine so you can navigate around very quickly. You can enter text anywhere there is a plain text box. HTML formatting must be accomplished by hand. I haven't tried it yet but one of the modules that adds the correct code for you at the press of a button might make things easier. It's on my to do list to try that. You can move around the administration section and change settings pretty easily. Comment moderation and responding is also very doable especially if you don't rely on a rich text editor. You can create basic blocks and nodes (I'm creating this post on my iPad) as well but the limitations I'll mention in a moment make it a frustrating task for anything beyond basic text entry.

Here's what you can't do. You can't use a WYSIWYG editor in a text area. You can work around that by making sure the "switch to plain text editor" link is available. That allows you to enter plain text but also wipes out the line breaks once you preview the node. So your nodes or blocks will have limited formatting. You also can't access your local file system which means that you can't upload attachments or images. So the expectation should be that you can do basic editing and content creation but nothing fancy. I use the Popups API to make things easier when managing blocks and comments. I've found that the resulting popups don't scroll so that module is not very helpful if you're on the iPad. You also can't scroll within or resize the text input area which makes creating long nodes very difficult. In fact nothing that usually involves clicking and dragging, or hovering the mouse works as far as I can see. In general the experience of managing Drupal via the iPad is a mixed bag. You can get to your site settings, manage comments and create basic nodes and blocks. Since I do my most serious managing of the site at home this level of access works fine for me. I'd like to upgrade the experience though. I suppose it's on Apple to offer access to the file system and perhaps upgrade mobile Safari to work with WYSIWYG editors. Even Google Docs doesn't work yet so we're not alone there.

The bottom line is that there are limitations that prevent anyone from doing serious development on a Drupal site via the iPad. So if you have your heart set on building and creating content on a light weight device then a netbook is a much better choice. So that's my take. If you have suggestions for work arounds, modules or helpful apps I'd love to hear about them in the comments.

Here are some screenshots that I added to this post after creating it on the iPad. From left to right they show what it looks like when editing a block, activating a popup dialog and editing a comment entry, all in landscape mode. I like the landscape mode better for management because it allows me to see the appropriate areas of the screen close up and the keyboard size is much more usable.

Drupal Block Editing on the iPad Drupal pop up dialog on the iPad. Drupal comment editing on the iPad.
Bookmark and Share Bookmark or Share Post

Creating A Custom Page Using Panels

This video shows you how to create a custom page for your site using the Panels module. You can use Panels to help you make pages (including a front page) that include a variety of content from your site including content that exists in views, blocks and nodes. The Panels module is dependent on the Chaos Tool Suite module.

Note: Click the 'full screen' icon (to the left of the volume control) in order to watch online at full 1280x720 resolution.

Bookmark and Share Bookmark or Share Post

Creating Custom Lists Using Nodequeue

The Nodequeue module is an incredibly useful module that allows you select individual nodes and place them in a list in whatever order you like. This lesson shows you how to create a new nodequeue, add nodes to the queue, arrange the queue and then add the queue to a view.

Note: Click the 'full screen' icon (to the left of the volume control) in order to watch online at full 1280x720 resolution.

Bookmark and Share Bookmark or Share Post

Easy Video Embeds With Embedded Media Field

This tutorial shows you how to use the Embedded Media Field module to embed video into posts.

Note: Click the 'full screen' icon (to the left of the volume control) in order to watch online at full 1280x720 resolution.

Bookmark and Share Bookmark or Share Post

Creating Short URLs For Twitter

Using three contributed modules (Shorten, Short URL and Tweet) I show you how to create short urls for your Drupal site that are easily shared on Twitter.

Note: Click the 'full screen' icon (to the left of the volume control) in order to watch online at full 1280x720 resolution.

Bookmark and Share Bookmark or Share Post

MP3 Audio Player

In this lesson I show you how to present uploaded mp3 audio files in a flash player using the MP3 Player module.

Note: Click the 'full screen' icon (to the left of the volume control) in order to watch online at full 1024x768 resolution.

Bookmark and Share Bookmark or Share Post

Image Gallery Enhancements

This lesson shows you how to enhance the image gallery created in the previous lesson using Thickbox, Media RSS and Views Slideshow.

The premium version of this lesson is encoded at the full 1024x768 resolution as originally recorded.

Bookmark and Share Bookmark or Share Post

Create An Image Gallery With CCK, Views And ImageCache

This lesson shows how to create an image gallery using CCK with ImageField, Views and ImageCache. CCK is used to create a new "image" content type that contains an upload field for images courtesy of ImageField. ImageCache is used to crop and resize the uploaded images. Views is used to display gallery page and an accompanying RSS Feed.

The premium version of this lesson is encoded at the full 1024x768 resolution as originally recorded.

 

Bookmark and Share Bookmark or Share Post
Syndicate content