The following module is an example which shows you the simplest way of Drupal themeing.
ykyuen.info
; $Id$ name = Theme customized block description = Theme the customized block. Ref: https://ykyuen.wordpress.com package = "YKYUEN" core = 6.x version = 6.x-1.0
ykyuen.module
<?php
/**
* Implementation of hook_block().
*/
function ykyuen_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Eureka');
$blocks[0]['cache'] = BLOCK_NO_CACHE;
return $blocks;
case 'view':
switch ($delta) {
case 0:
$block['content'] = theme('eureka', 'Welcome to Eureka!', 'https://ykyuen.wordpress.com');
break;
}
return $block;
}
}
/**
* Implementation of hook_theme().
*/
function ykyuen_theme() {
return array(
'eureka' => array(
'arguments' => array(
'name' => NULL,
'link' => NULL
)
)
);
}
/**
* Implementation of theme_eureka().
*/
function theme_eureka($name, $link) {
return "<a href=\"$link\">$name</a>";
}
Enable the module and then configure the block.

Done =)
Next: Drupal – Introduction to Drupal Theming @ 2
Reference:


2 thoughts on “Drupal – Introduction to Drupal Theming @ 1”