Post Calendars for Drupal

2nd Aug
2005

If you check out the front page of this site, you'll see I've stolen those little 'calendar' type icons to display the date of my posts. I first noticed em on mozilla.org, but they're appearing on many a blog site.

I've cobbled together a Drupal module which will achieve this. The post calendar code is inserted into the node body and teaser using nodeapi. Its effectively replacing the normal post info Drupal provides, which should be switched off in the theme.

AttachmentSize
postcalendar.tar.gz730 bytes
postcalendar.module.phps1.41 KB
postcalendar-4.7.module.phps1.52 KB
postcalendar-4.7.tar.gz658 bytes
Tags:

Comments

Update for Forms API

I've added a new version of the module intended for use in current CVS HEAD (and eventually 4.7) versions of Drupal. This change brings the module up to date using the new Forms API.

Please use the 4.7 module only for sites with Forms API applied.

Hindsight

In hindsight, this is not the best method of achieving the 'post calendar' icons... theming the existing post date seems like a much more sensible option.

Recently I updated this site's theme (based on Internet Jobs by Luka Cvrk), and included some theme tweaks to achieve the same effect.

In node.tpl.php:

  1. <div class="node-content">
  2. <span class="calendar-icon">
  3. <?php print format_date($node->created, 'custom', 'jS M'); ?>
  4. </span>
  5. <?php print $content ?>
  6. </div>

In my stylesheet:

  1. /*
  2.  * =Calendar icons
  3.  */
  4. .calendar-icon {
  5. width: 30px;
  6. border: 1px solid #e0e0e0;
  7. border-color: #e0e0e0 #b0b0b0 #a0a0a0 #e0e0e0;
  8. background-color: #f2f2f1;
  9. padding: 4px;
  10. margin: 0 6px 2px 0;
  11. text-align: center;
  12. float:left;
  13. }

Much better.

Thanks!

I know this is as old as dirt, but thanks! This is a nice little UI enhancement. I like the option to "link to the archives"... quite handy. Thanks, Mike