drupal

Is there a module for that?

More often than not, this website provides the correct answer out of the box:

http://isthereamoduleforthat.com/

(mostly for my Drupal-using bretheren...).

Easy Embedding of HTML5 Video on a Drupal Site

For the past year, I've watched the HTML5 <video> element debate (mostly over video formats/containers) with a great interest—I abhor having to use Adobe Flash on my sites to embed video, especially since that means many videos don't work on my Linux workstation (which doesn't have Flash), or on my iPhone/iPad.

The HTML5 <video> element (and similarly, the less-supported <audio> element) promises to take away the stress of having to have flash players, FLV-encoded video, etc. just to show a viewer a non-static piece of content.

In its simplest form, you can add the following code to embed a video on your page:

<video src="video-file.m4v"></video>

On my Drupal sites, I've been wanting to be able to simply grab an m4v video exported from iMovie, QuickTime, or straight from my camera, attach it to a post via a filefield, and have it display. In the old days, I would use SWFTools to embed the video using Flash.

I've found a solution that, in my opinion, is much more elegant, using the <video> element, with a Flash fallback for Internet Explorer:

  1. I set up a filefield with which I can attach an m4v file to a piece of content.
  2. I enabled Custom Formatters (an excellent Drupal module for CCK), and set up a simple formatter for this filefield with the code below:

Drupal Gardens enters Open Public Beta

...and now anyone can set up a fresh, hosted Drupal 7 website in seconds—for free.

From Dries Buytaert, creator of Drupal, and president of Acquia, the company behind Drupal Gardens (basically, a site like wordpress.com, except with more awesome):

Today we’ve reached another important milestone at Acquia: Drupal Gardens is now in open beta. No more beta codes. No more waiting to try the service. Now anyone can access Drupal Gardens and create a free Drupal 7 site!

I expect this service, and others like it, to grow in popularity in the coming years. For many parishes, a site on Drupal Gardens would do 90% of what they'd need (or 100%, if they weren't shooting for the stars...).

And it's free (for basic plans), community-based, and super-easy to use (the theme developer is especially nice). On top of that, you can, at any time, download your entire site and put it on your own web host!

Setting up an Apache Solr Search Server (for many sites/hosts)

Magnifying GlassIn the Archdiocese of St. Louis, I manage more than 15 separate Drupal websites (plus a few others), and I have often wanted to use Apache Solr for search across all these sites. I finally had some time to tackle this issue, and I have a pretty good (and very fast) Solr server set up, and this server is shared across all these sites on two (so far) different webservers through two different hosting companies.

The main Archdiocesan sites (archstl.org, archstldev.com, and stlouisreview.com) are all hosted via SoftLayer in Dallas, while Catholic Youth Apostolate sites (like stlyouth.org and cycstl.net) are hosted via Hot Drupal in North Carolina.

I was able to set up a linode (linode.com) for less than $20 to run Apache Solr via Jetty, and that server is then accessible to all our other servers to send and receive search index data. This solution allows our main web servers to keep resources free from expensive MySQL search queries and the large databases that result from storing 20k+ nodes' search data in the main site DB.

You can find the process by which I set up the search server in this issue on the Development website. The best thing about this system is that I can really make the search server fly; ping takes about 30-40ms between the search server and our other servers, and queries only take about 150-250ms to reach the websites.

Any large organization looking to vastly improve search performance (and usability), especially on a Drupal site (it's so easy, with the Apache Solr Search Integration module pluggable right out of the box), should look into setting up a dedicated search VPS or server (depending on your search traffic).

Our linode Solr server typically sits close to idle, even at peak hours (right now it's showing 0.00, 0.00, 0.00), and I'll probably set it up to do some other tasks off-site as well, since it has the spare CPU, memory and disk space available (and a really fat pipe to the Internet!).

Drupal: Restoring core comment title permalinks in a Zen Subtheme

I was scratching my head after trying to troubleshoot a template problem for a few hours today; I was building a Zen subtheme for a site that had, until now, been using Garland for it's styling. In this subtheme, I wanted to have comments display with a similar look to Garland, and I especially wanted automatic permalinks to comments, referenced by a comment number:

Comment template - zen removes linked comment number titles.

I looked through comment.tpl.php, and my template.php file, as well as zen's template.php file, but couldn't find anything related to the $id variable, which is used to build the numbered permalink. After opening up Devel themer, I found that there was a call to _zen_preprocess_comment(), and that was the likely culprit...

To restore these comment numbers/permalinks, you will need to grab core's TEMPLATE_preprocess_comment function and place it in your subtheme's template.php file. (This is an easy fix... if you'd like to get more advanced, you can hack the code to do other more Zen-like things, like print 'first' and 'last' classes for comments).

Be sure to change TEMPLATE to the name of your theme!

After you do that, your theme should have comment styling very similar to that of other core themes, with the permalink comment number intact (see below for the final product).

Pretty Zen comment titles - numbered permalinks!
(numbered permalinks ftw!)

Set a View's Context Inside an Organic Group

A very simple way to allow a view to display as if it were a page in an organic group on your Drupal site: Simply paste the code below in your view's Header or Footer, using the PHP Code input format.

<?php
og_set_group_context
(node_load(46405));
?>

Note: the node ID inside node_load() must be set to the group into which you'd like the view to display. To get this to function perfectly (as of OG 2.1), you might need to apply the patch in this issue on drupal.org: Group theme doesn't display on Views that take group as an argument. (Otherwise the group's custom theme might not get set).

There are some alternative methods to getting views to display inside groups, but this is a quick and easy solution.

Post Photos to Your Drupal Site from the iPad

Over on my personal blog, I write about how to post photos from the iPad to ImageFields on a Drupal site. I intend to do so quite a bit this weekend on my visit to New York City (this will be my first trip without a laptop—yikes!).

I basically use Dropbox as a middleman to get a URL for the photo, which I can pass to FileField Sources so my Drupal site can use the photo. Unfortunately, for the time being, Mobile Safari doesn't support file select fields :-(

Franciscan Monks Involved in Drupal Core Development!

According to Dries Buytaert, a Franciscan Monk was working on Drupal Core at DrupalCon SF last week; he was involved in the core developer's summit with 149 other attendees.

[At Drupalcon, we] organized a core developer summit with 150 attendees, 16 lightning talks, 11 breakout sessions and 1 Franciscan monk.

Where are the Jesuits? The Dominicans? Any other orders? In the Archdiocese of Saint Louis, many of the curial websites are running on Drupal. I also hear the Legionaries have a lot of Drupal involvement (for instance, their Familia website).

Speeding up a Site: Quicker 404 Errors for files in Drupal

On the Archdiocese of Saint Louis website, we moved thousands of files around as part of our site migration from 49 separate Joomla sites to Drupal. Internally, all our file links were updated. However, there are thousands of hotlinks from different websites to the Archdiocesan website (for instance, the blog American Papist hits a missing file of a Church interior about 80 times a day).

This was creating a lot of overhead for the server, as Drupal would do a full bootstrap, sending out a fully-rendered 404 page on each missing file request.

Looking to Drupal forums for help, I found some help from kbahey, founder/owner of 2bits, a Drupal shop that specializes in speeding up large Drupal sites. The advice in the issue linked above has the proper code for speeding up requests on a Drupal 7 site, but the code is slightly different for Drupal 6.x. Here's the code:

<?php
/**
* 404 Handling, to conserve server resources upon missing image/text/non-html file.
*/
if (preg_match("/\.(txt|png|gif|jpe?g|shtml?|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/", $_SERVER['QUERY_STRING'])) {
header('HTTP/1.0 404 Not Found');
print
'<html><head><title>404 Not Found</title></head><body><h1>404 Not Found</h1><p>The requested URL was not found on this server. If you think you reached this page in error, please visit the <a href="http://archstl.org/">Archdiocese of Saint Louis home page</a> and search for the page or file for which you are looking.</p></body></html>';
exit();
}
?>

You can simply paste this at the bottom of the settings.php file.

In a nutshell, it does the following: If the request is for a file in it's list of regular expressions, and the file is not found, it will output 404 headers, along with a simple HTML string.

This is a heck of a lot faster than allowing a full Drupal bootstrap on each missing file request—an operation which, on our server, takes up a nice 30 MB of RAM, plus a lot extra CPU usage per request, when compared with using the code above.

Certified to Rock - Neat Drupal User Involvement Measurement Tool

Just found this cool tool to see how involved ("Certified to Rock") you might be, in the Drupal community. The tool will be getting some updates soon, but for now, if you are a drupal.org user, check your username on Certified to Rock.com, and see how you rank!

Certified to Rock

Syndicate content