Community & Support

Token replacement in template.php

[insert usual preamble about being new to Drupal theming, not new to php]

On the page here titled Inserting a "last updated" value into your footer, there is syntax which looks basically like:

$last_updated = "blah blah";

$tokens = array(
    '!last_updated' => $vars['last_updated']
);

$vars['footer_message'] = strtr($vars['footer_message'], $tokens);

My question is: how does $last_updated magically become $vars['last_updated']? When I run this code, not unexpectedly, my token is replaced with an empty string.

Thanks in advance for any help.

Comments

I take it from the silence

I take it from the silence that no one knows, and therefore this is bad code. I'll go edit the page in question and someone can change it back if there's a good explanation for this behaviour.