¶ Going Directly To The Attachment When Viewing A CCK Content Type That Just Has Attachments
Sunday, January 4, 2009, 11:00am
So I've been working on our Intranet redesign with Drupal and one issue we have is we want people to be able to post PDFs to the Intranet. The simplest way to handle this in Drupal is to create a content type for PDF and use the CCK file field to give people the ability to upload files. This way the PDFs sit by themselves and won't have to be attached to a particular page (which is what happens if you use the default Drupal upload module). Also the upload module makes it so that any node can have files attached which I didn't want.
The issue with doing it this way is that when you click on a PDF node you end up at a page that has the Title and a link to the PDF you uploaded. This isn't what we wanted. Instead we wanted the link to take us to the PDF proper. To do this one has to make a template for that content type. Normally when you want to alter the template for a content type you create a new node template. But this only allows you to alter the content portion of the screen (ie. the portion where the node displays usually the center of the screen). If you want to change something more than this you need to alter both the page and node template along with adding some new info to your template.php file.
Very clever, I love this!
¶ Using The Filefield Module With jQuery To Host Your Own Screencasts
Tuesday, July 8, 2008, 7:43am
Here is a fast lesson on one of the many (many) ways of hosting and presenting video on your own Drupal website. The CCK Filefield and jQuery Media modules are a one-two knockout combination that allow users to upload media files to fields in your custom content types and then play back the media files in the correct player or handler. It's a great replacement for the video module and integrates nicely with any modules that like to do things with fields.
Image (And File Handling) In Drupal 6 And Beyond
Sunday, June 29, 2008, 11:54am
In the beginning (2002), there was Image, and everyone could create images as nodes and all was good, if a bit simplistic. (There was even IPTC and EXIF metadata support). After a little bit of time, you could even attach images to nodes. By 2006, images could be attached to nodes. (By now, Flexinode had been around for a while and CCK had been around for a bit, too.) CCK became the predominant way of creating content types, as opposed to writing a new module for each individual content type. ImageField, a CCK add-on, (released in July 2006) allowed images to be handled by CCK. This, combined with other CCK fields let you do all sorts of neat things like set up an online store with one field being the name of the object your are selling, another field being the description and another three or four fields for uploading images of the product. Or you could be an online newspaper and have anywhere from zero to several images per article. Each page (whether online store or newspaper) could be themed to layout the information appropriately with ImageCache creating derivative (read: resized and/or cropped) images.
Fast forward to 2008 and there's primarily two ways to get images in your Drupal site, with Lullabot's Image vs. ImageField and ImageCache being the definitive comparison between the two. If you were fine with images as nodes and had simple needs (gallery, photoblog, etc.) you probably went with (or continued using from back in 2002) Image. On the other hand, if you were creating tons of content types thanks to CCK, you probably jumped ship to ImageField.
Now, there's talk about merging Image with ImageField (and ImageCache), with a script to migrate from Image to ImageField. But it was also pointed out that one field to handle all uploaded files, images or not, should be the way to go and that this would be the end of ImageField. FileField, combined with FileField Image would handle everyone's imge handling needs (as well as other file types as well).
While some people think images need special handling (and they are right to a degree and FileField Image takes care of this) there is also the consideration that other file types need special handling, such as videos. Just like images have a need for derivative images, so do videos (original high resolution, low resolution, stored as a flash file and a thumbnail screencap to display in the page). Having one unified way of uploading files would mean less code to maintain and there might even be a reasonable chance of getting file (and potentially image) handling in core, the CCK way.
(For these reasons, I've decided to postpone a D6 release of MAQUM.)