I was working on a new site for my business and banging my head against the wall because the teasers were displaying more information than I wanted them to and I couldn’t figure out how to fix it. After several hours I finally got it; here’s how:
The Drupal Situation
This Drupal 6 site is for user-generated videos. When a user chooses to upload a video to the site, the MediaMover module (more on this module later) sends the video to our CDN (currently YouTube), retrieves the embed code, puts that in the Embedded Media module, which then creates a thumbnail and saves the node. All this is well and good except that the teasers that are created for these nodes contain more than what CCK will allow me to adjust. When I look at the display fields in the content type editor, it only allows me to change the settings for the field where the original video is uploaded and the field that holds the embed code. So what am I supposed to do when the teaser generates information about the user who submitted the node, the timestamp of when it was submitted, and all the other information that my other modules add to it?
Possible Solutions
If you have done any work with themes in Drupal, you are probably aware that in the global configuration section of the administrative theming area of your Drupal 6 site you can change what information is displayed on a node. For instance, I don’t think it is necessary or attractive to have the user name and timestamp displayed on an about or help page. Changing these global configurations is useful for cleaning up nodes like that. Making those changes wouldn’t be a good solution for my videos because on the full node, I do want that information visible.
Another possible solution would be hacking around in the php of the template files. I have been learning php and have successfully made a few minor modifications into these template files. However, something of this magnitude was far outside of my element.
Views: a powerhouse among Drupal Modules
Finally, I came upon my solution. I had been using the Views module already to organize my teasers, and suddenly I realized that I could use a grid style and choose a separate row style for fields. These options are in the first column. In the second column in the fields box, I selected the fields from my nodes that I wanted to display–in this case I chose the node title and content: embedcode. The key was at the bottom of the settings page for the embedcode field. There is a drop-down box for the format of the field. Here I selected the thumbnail that linked to the node. I adjusted a couple other settings, saved the view, and before I knew it, I was looking at exactly what I wanted: clean teasers, no baggage.
Now, if I could only get the related content figured out…
Leave a Reply