In the course of a conversation with Jesse today, I launched into action to fix the copyright statement in my site’s footer block. It still listed the copyright dates as “1999-2009” when the year had clearly rolled over into 2010 some time ago. Ahem.
Drupal 6, to my knowledge, doesn’t have a built-in way to insert a variable into the body of a text field in a node or block. However, it does have the very-powerful Token API, of which I’m a big fan. Tokens let you insert variable data. It’s just not always easy to figure out how a mere mortal — rather than a module developer — can take advantage of tokens in Drupal. (Variable insertion was a key feature of the UserLand Manila CMS I started using in the late 90’s, and I miss that sort of capability.)
In Drupal 5, I had previously used the Copyright module. Copyright module integrated with the Token API so you could use tokens in the block it created. The module was never upgraded for Drupal 6, so my footer copyright block became static text.
I realized that an Input Filter that worked with the Token API would probably let me do what I want, and I found a module that provided that missing link.
Here’s what I did so I could insert a constantly-advancing date variable into my copyright footer block:
- Downloaded Token Filter module.
- Installed Token Filter module.
- Enabled Token Filter module via the Admin Menu: Site Building > Modules > List.
- Added Token Filter to my standard Input Filter used across the site.
- Changed “2009” in my copyright block to “[site-date-yyyy]” which didn’t work, and then read the Token Filter docs to find out that should have been “2012” which then worked.
Now, my copyright block should always show the current year in the date range, like this: 1999-2012.