Theming
Theming
Given all the possible ways a site might want to display the event information, a content theming mechanism is provided. It exposes all of the node and block content as raw data allowing total control over content. The results of this function are passed in the standard way to the block.tpl.php theming mechanism.
To customize This Day in History blocks, create a template.php function
named {theme_name}_thisdayinhistory_block. For example, for the Garland theme
the function name is: garland_thisdayinhistory_block
The following parameters are provided to the function call:
P1: an array containing the block information P2: an array of Historical event nodes
The function definition would therefore look something like:
<?php
function {theme_name}_thisdayinhistory_block($block, $nodes) {
// theme code producing a content string
return $string_variable_containing_content
}
?>Blocks are individually themable by appending the block number to the function
name. The block number is displayed on the menu:
Administer > Site configuration > This Day in History > Configure blocks
For example, if you were using the Garland theme and wanted to theme the "Example Block" shown in the previous screen shot as block id 14, you'd create a function named: garland_thisdayinhistory_block_14
To easily see the available values use the following code (you'll need to change the name to match your theme name):
<?php
function {theme_name}_thisdayinhistory_block($block, $nodes) {
$output = '<p>$block:</p><pre>' . htmlentities(print_r($block, TRUE)) . '</pre>';
$output .= '<p>$nodes:</p><pre>' . htmlentities(print_r($nodes, TRUE)) . '</pre>';
return $output;
}
?>If you are unsure how to write the theming function you can use the code in the module's theming function: theme_thisdayinhistory_block as a starting point. Simply copy the code into your theming function.
