suzi's blog

my new favorite website

not sure if i had one before but this is now my favorite website.

http://www.isitchristmas.com

they even have a feed:
http://www.isitchristmas.com/rss.xml

photos on musicbox

Late last night we launched the first round of photo content on the Musicbox site:
http://musicbox.sonybmg.com/photos
Lots of image cache rules, fun jcarousel implementations, views and panels 2 rule supreme here. To come: user submitted photos and special editor created galleries.

britney goes drupal

It's official - britney.com has been drupalized, b*tch. We used panels2 for the homepage layout. That is indeed shaping up to be a powerful weapon. Not the homepage, silly, panels2 (warning - still in alpha). This was a good theming challenge and I love Doug's tabloid design. Very fun. Poor Britney tho. See what happens to girls who marry Fresno boys?

the suzi shuffle

Friday was my last day with Advomatic. It was a great year + working with the band of genius drupallers. For the next couple weeks I am officially unemployed (aka on vacation), then I go to work for Sony. I want to up the ante with the theming capabilities for the multisite project, which I am pretty familiar with. Over the last 6 months (as an Advomite) I themed websites for: Justin Timberlake, Tori Amos, Mario, T-pain, Katharine McPhee, Say Anything, and The Dey. I think I will be doing some stuff for the Musicbox Video project too. I'm especially excited about working with Earl Miles aka merlinofchaos, daddy of Views, Panels and Node Queue. If you are curious about the Sony projects check out the Lullabot Drupal Podcast No. 39: Doug Gottlieb of Sony/BMG Records.

Re-theming the aggregator block

A nice person who shares the same name as a famous hair dude contacted me asking how to the drupal news aggregator block show teasers rather than simple titles. This is for the non-profit "The Epilepsy Support Centre". He pointed to this post where I reference themable function overrides in template.php. Go figure - this site must be googleable.

Theme overrides are really very simple for those brave enough to grep through the module code and do some experimenting. note: this is for drupal v 5.x but the process is the same for any version using a phptemplate based theme.

In this case a simple 'find all' search in aggregator.module for the term 'theme' returns a pretty short list of items, you will notice toward the bottom a few references to "@ingroup themeable". This is the good stuff.

The original code from the module begins line 1317

<?php
/**
* Format an individual feed item for display in the block.
*
* @ingroup themeable
*/
function theme_aggregator_block_item($item, $feed = 0) {
global $user;

if ($user->uid && module_exists('blog') && user_access('edit own blog')) {
if ($image = theme('image', 'misc/blog.png', t('blog it'), t('blog it'))) {
$output .= ''. l($image, 'node/add/blog', array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), "iid=$item->iid", NULL, FALSE, TRUE) .'';
}
}

// Display the external link to the item.
$output .= 'link) .'">'. check_plain($item->title) ."\n";

return $output;
}
?>

There's lots we can do away with here, like the 'blog it' links and the titles themselves since they are part of an aggregator teaser already. Since we know we want the block to mimic the teaser from the aggregator news page the next step is to find how that is generated. Scroll down to line 1355 and you'll see "Format an individual feed item for display on the aggregator page.", the function is "function theme_aggregator_page_item($item)" The part we want to steal is line 1377:

<?php
if ($item->description) {
$output .= ''. aggregator_filter_xss($item->description) ."\n";
}
?>

Put this all together in template.php inside your theme directory. Replace the part of the function name that reads theme_ with phptemplate_ and you are all set! Here's the final snippet:

<?php
/**
* Format an individual feed item for display in the block.
*
* @ingroup themeable
*/
function phptemplate_aggregator_block_item($item, $feed = 0) {
// Display the feed teaser link to the item.
if ($item->description) {
$output .= ''. aggregator_filter_xss($item->description) ."\n";
}
return $output;
}
?>

The added bonus with this change is the block titles won't get ugly like they usually do with the check_plain() filter turning html into ascii characters. You can see the function for the aggregator_filter_xss() filter at line 1395:

<?php
/**
* Safely render HTML content, as allowed.
*/
function aggregator_filter_xss($value) {
return filter_xss($value, preg_split('/\s+|<|>/', variable_get("aggregator_allowed_html_tags", '

      • '), -1, PREG_SPLIT_NO_EMPTY));
        }
        ?>
  • Happy drupal theming!

    Pages

    Subscribe to RSS - suzi&#039;s blog